django 报错:Application labels aren't unique, duplicates: App

运行django时报如下错误

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

原因:可能是用自动生成django项目时,在settings中已经自动注册app模块l,如下:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'App.apps.AppConfig',
]

然后可能在不知情的情况下又注册了一次app模块,如下:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'App.apps.AppConfig',
    'App'
]

这时就出现问题了,删掉其中的任何一个就能解决问题

你可能感兴趣的:(django 报错:Application labels aren't unique, duplicates: App)