python
config_error
ai_generated
true
werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'login'. Did you mean 'register' instead?
ID: python/flask-redirect-endpoint-not-found
80%Fix Rate
87%Confidence
0Evidence
2024-09-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
在 url_for() 或 redirect() 中使用了不存在的端点名称。
generic中文
在 url_for() 或 redirect() 中使用了不存在的端点名称。
Workarounds
-
100% success
@app.route('/login', endpoint='login') def login_view(): pass # 然后在其他地方使用 redirect(url_for('login'))
Dead Ends
Common approaches that don't work:
-
80% fail
会破坏 Flask 的路由系统,且不灵活
-
70% fail
会导致路由冲突,且不解决根本问题