我收到了错误:
django.db.utils.IntegrityError: insert or update on table "auth_permission" violates foreign key constraint "auth_content_type_id_508cf46651277a81_fk_django_content_type_id"
DETAIL: Key (content_type_id)=(1) is not present in table "django_content_type".
我找到this post但没有推荐有帮助:
ContentType.objects.clear_cache()
move 'django.contrib.contenttypes' before 'django.contrib.auth' in INSTALLED_APPS
有没有人找到解决这个问题的方法?
详细信息:my settings.py
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'webpack_loader',
'rest_framework',
'corsheaders',
'common',
'humans',
'validations',
'accounts',
'comments',
'errors',
'django_nose',
'reports',
'dashboards',
'cacheops',
'djcelery',
)
答案 0 :(得分:1)
INSTALLED_APPS=(
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
.....
.....
)
你可以改变订单吗?再次重置db run migrate。