【发布时间】:2012-12-22 08:44:45
【问题描述】:
我对 Python 和 Django 完全陌生,但我需要在我的服务器上安装 testbedserver-software(为此我遵循tutorial)。现在我在运行以下命令时遇到了麻烦:
python manage.py syncdb
显示以下错误:
CommandError: One or more models did not validate:
menu.bookmark: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
dashboard.dashboardpreferences: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
这是我的 manage.py:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "controller.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
这是我的 settings.py:
from controller.settings_example import *
# Probably you want to override at least the database configuration:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'controller',
'USER': 'confine',
'PASSWORD': 'confine',
'HOST': 'localhost',
'PORT': '',
}
}
我已经找到了这个http://grokbase.com/p/gg/django-users/12ar0b12ca/ver-1-5-specifying-custom-user-model-extends-abstractuser-doesnt-work。 但我什至不知道在哪里应用该解决方案。 (我什至不知道这个问题是基于 PostgreSQL、Python 还是 Django...)
有人可以帮我解决这个问题吗?
提前致谢, 阿托比
【问题讨论】:
-
设置中没有其他内容了吗? Django 似乎认为你设置了
AUTH_USER_MODEL。哦,这是什么版本的 Django? -
听起来你有 Django import django django.VERSION 看看你使用的是什么版本。
-
@JoeDoherty: django 版本 (1, 6, 0, 'alpha', 0) 所以我猜是 1.6?
-
@scytale:对不起,是的,它似乎导入了 settings_example.py 并包含以下内容:pastebin.com/DgNQsq1M
-
看看它在错误中谈论的模型。可能有一个具体的参考,比如
user = ForeignKey()。我还没有使用 1.5,所以我可能有点过时
标签: python django postgresql