python
runtime_error
ai_generated
true
ValueError:名称 'auth' 已为此蓝图注册。使用 'name=' 提供唯一名称。
ValueError: The name 'auth' is already registered for this blueprint. Use 'name=' to provide a unique name.
ID: python/flask-blueprint-name-collision
80%修复率
87%置信度
0证据数
2025-02-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 2.x | active | — | — | — |
| 3.x | active | — | — | — |
根因分析
在同一应用中注册了两个同名的蓝图。
English
Registering two blueprints with the same name in the same app.
解决方案
-
95% 成功率
bp = Blueprint('auth_v2', __name__) -
90% 成功率
app.register_blueprint(bp, name='auth_v2')
无效尝试
常见但无效的做法:
-
60% 失败
The blueprint's internal name attribute is what matters, not the variable.
-
90% 失败
Name collision still occurs.