# Werkzeug 路由错误：无法为端点 'external' 构建 URL，包含值 ['scheme', 'host']。你是想用 'index' 吗？

- **ID:** `python/flask-url-for-external-scheme`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

尝试使用 url_for 引用不存在的端点，或提供了路由中未定义的额外参数。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (100% 成功率)
   ```
   Define the route correctly: @app.route('/external') def external(): return 'ok', then use url_for('external')
   ```
2. **** (80% 成功率)
   ```
   If external URL needed, use url_for('index', _external=True) if index exists
   ```

## 无效尝试

- **** — The endpoint still doesn't exist; _external only affects the URL scheme. (90% 失败率)
- **** — These are not valid parameters for route building unless defined in the route. (80% 失败率)
