Application labels aren't unique, duplicates:x 或. declare explicit app_label isn't INSTALLED_APPS.

    django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, 
    duplicates: XXX
    
    RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't 
    declare an explicit app_label and isn't in an application in INSTALLED_APPS.

两个原因是一个原因造成的。


INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog.apps.BlogConfig’,
     ‘xxxapp’
]

xxxapp注册多余了,删掉即可

创建的应用中settings.py文件INSTALLED_APPS注册文件按之前手动自行注册了应用名称。

其实不需要注册就好,更新django1.11.3后,django创建应用的时候已经帮你注册了xx.apps.XXConfig了。

在pycharm中创建django中选择了注册app(一个可选项),其实也已经注册了。

你可能感兴趣的:(Application labels aren't unique, duplicates:x 或. declare explicit app_label isn't INSTALLED_APPS.)