How to resolve “django.core.exceptions.ImproperlyConfigured: Application labels aren’t unique, duplicates: foo” in Django 1.7?

The problem is that with the changes to apps in Django 1.7, apps are required to have a unique label.

By default the app label is the package name, so if you’ve got a package with the same name as one of your app modules (foo in this case), you’ll hit this error.

The solution is to override the default label for your app, and force this config to be loaded by adding it to __init__.py.

# foo/apps.py

from django.apps import AppConfig

class FooConfig(AppConfig):
    name="full.python.path.to.your.app.foo"
    label="my.foo"  # <-- this is the important line - change it to anything other than the default, which is the module name ('foo' in this case)

and

# foo/__init__.py

default_app_config = 'full.python.path.to.your.app.foo.apps.FooConfig'

See https://docs.djangoproject.com/en/1.7/ref/applications/#for-application-authors

Leave a Comment