# 断言错误：名称 'auth' 未注册为蓝图。您是否忘记注册它？

- **ID:** `python/flask-blueprint-not-registered`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

蓝图必须在 Flask 应用程序中注册后才能使用。

## 版本兼容性

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

## 解决方案

1. **Register the blueprint with the app** (100% 成功率)
   ```
   from myapp.auth import auth_bp
app.register_blueprint(auth_bp)
   ```
2. **Check the blueprint name and register correctly** (95% 成功率)
   ```
   print(auth_bp.name)  # ensure it's 'auth'
app.register_blueprint(auth_bp, url_prefix='/auth')
   ```

## 无效尝试

- **Importing the blueprint but not calling app.register_blueprint** — Registration is required to add routes. (100% 失败率)
- **Registering with wrong name** — The name must match the blueprint's name attribute. (80% 失败率)
