Django 1.10.7之外的Django数据库层出错

时间:2017-07-09 17:46:29

标签: python django

我正在使用django 1.10关注此question的答案,我怎么跟踪错误:

RuntimeError: Model class django.contrib.auth.models.Permission doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

我尝试将它抱怨的应用程序添加到INSTALLED_APPS但我仍然收到错误。如何让我的示例代码在下面工作?

from django.conf import settings

DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2',
  'HOST': '',
  'NAME': 'mydb',
  'PASSWORD': '',
  'PORT': '',
  'USER': ''}}
DATABASES['default']['ATOMIC_REQUESTS'] = True


settings.configure(
    INSTALLED_APPS = ['django.contrib.contenttypes', 'ob_site.strats.apps.StratsConfig'],
    DATABASES = DATABASES,
    TIME_ZONE = 'UTC')

import django
django.setup() # error is thrown here

0 个答案:

没有答案