python
config_error
ai_generated
true
Django配置错误:应用标签不唯一,重复:myapp
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: myapp
ID: python/django-app-not-registered
80%修复率
86%置信度
0证据数
2024-08-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
在INSTALLED_APPS中注册了两个具有相同app_label的不同应用。
English
Two different apps with the same app_label are registered in INSTALLED_APPS.
解决方案
-
95% 成功率 Change app_label in AppConfig
class MyappConfig(AppConfig): name = 'myapp' label = 'myapp_unique' -
90% 成功率 Remove duplicate app entry
Remove one of the duplicate entries from INSTALLED_APPS.
无效尝试
常见但无效的做法:
-
Removing both apps
70% 失败
Loses functionality.
-
Renaming app folder only
90% 失败
app_label remains same.