运行Django服务器时如何解决重复的应用程序问题

时间:2020-05-22 20:30:24

标签: python django python-3.x

我创建了一个名为session_booker的Django应用,并添加了一个名为sessions的应用。当我尝试运行Django服务器时,出现此错误:

$ python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/Users/me/.local/share/virtualenvs/SessionBooker-fBhCDalc/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/me/.local/share/virtualenvs/SessionBooker-fBhCDalc/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/Users/me/.local/share/virtualenvs/SessionBooker-fBhCDalc/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/me/.local/share/virtualenvs/SessionBooker-fBhCDalc/lib/python3.8/site-packages/django/apps/registry.py", line 93, in populate
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: sessions

我什至不知道从哪里开始。我猜我在不知不觉中创建了两个sessions应用程序。如果是这样的话,我可以删除一个地方吗?谁能告诉我该如何解决?

这是我安装的应用程序:

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

1 个答案:

答案 0 :(得分:1)

名称会话干扰了他内置的

    'django.contrib.sessions',

因此,在您的情况下,请将应用程序名称更改为其他名称