python config_error ai_generated true

django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: myapp

ID: python/django-app-not-registered

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-08-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

Two different apps with the same app_label are registered in INSTALLED_APPS.

generic

中文

在INSTALLED_APPS中注册了两个具有相同app_label的不同应用。

Workarounds

  1. 95% success Change app_label in AppConfig
    class MyappConfig(AppConfig):
        name = 'myapp'
        label = 'myapp_unique'
  2. 90% success Remove duplicate app entry
    Remove one of the duplicate entries from INSTALLED_APPS.

Dead Ends

Common approaches that don't work:

  1. Removing both apps 70% fail

    Loses functionality.

  2. Renaming app folder only 90% fail

    app_label remains same.