I was updating a site from Django 1.5.x to 1.7 to take advantage of the new, built-in migrations, when I ran into this error:
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: utils
It kind of made sense because I have a directory of common code that has a bunch of apps. I combine that code with my current project by symbolically linking to common_code in my site packages. Both my current project and common_code have apps called “utils”.
In settings.py I load both:
INSTALLED_APPS = [..., 'utils', 'common_code.utils', ...]
Prior to Django 1.7, that worked fine. But that no longer works in 1.7.
The solution is in the new Applications section of the docs. Applying it to my specific case, in my current project utils app, I added a file: apps.py. Here is the contents of apps.py:
from django.apps import AppConfig class MYUtils(AppConfig): name = 'utils' # Full Python path to the application label ='my_utils'
The docs mention something about adding code to utils.__init__ to avoid having to change your settings file. But in my case, it seemed simpler to change settings.py to:
INSTALLED_APPS = [..., 'utils.apps.MYUtils', 'common_code.utils', ...]