简体   繁体   English

Django/Python:更新关系以指向 settings.AUTH_USER_MODEL

[英]Django/Python: Update the relation to point at settings.AUTH_USER_MODEL

I'm completely new to Python and Django, but I need to install testbedserver-software (for which I follow this tutorial ) on my server.我对 Python 和 Django 完全陌生,但我需要在我的服务器上安装 testbedserver-software(我遵循本教程)。 Now I'm running into trouble when running following command:现在我在运行以下命令时遇到了麻烦:

python manage.py syncdb

The following error is shown:显示以下错误:

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.

This is my manage.py:这是我的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)

This is my settings.py:这是我的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': '',
}
}

I already found this http://grokbase.com/p/gg/django-users/12ar0b12ca/ver-1-5-specifying-custom-user-model-extends-abstractuser-doesnt-work .我已经找到了这个http://grokbase.com/p/gg/django-users/12ar0b12ca/ver-1-5-specifying-custom-user-model-extends-abstractuser-doesnt-work But I don't even know where to apply the solution.但我什至不知道在哪里应用解决方案。 (I don't even know this problem is PostgreSQL, Python or Django based...) (我什至不知道这个问题是基于 PostgreSQL、Python 还是 Django...)

Can someone help me with this?有人可以帮我弄这个吗?

Thanks in advance, atobi提前致谢,阿托比

in settings_example.py you have AUTH_USER_MODEL = 'users.User' .settings_example.py你有AUTH_USER_MODEL = 'users.User' However you are using an app - menu.bookmark - that has a relation to django.contrib.auth.User - you can't have both.但是,您使用的应用程序 - menu.bookmark - 与django.contrib.auth.User有关系 - 您不能同时拥有两者。 Setting AUTH_USER_MODEL means that you are replacing the built-in Django user model with your own.设置AUTH_USER_MODEL意味着你正在用你自己的替换内置的 Django 用户模型。 See http://procrastinatingdev.com/django/using-configurable-user-models-in-django-1-5/ for details.有关详细信息,请参阅http://procrastinatingdev.com/django/using-configurable-user-models-in-django-1-5/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更新关系以指向settings.AUTH_USER_MODEL - Update the relation to point at settings.AUTH_USER_MODEL 无法在 Django 中设置 settings.AUTH_USER_MODEL - Failed to setup settings.AUTH_USER_MODEL in Django Python Django - “AUTH_USER_MODEL 指的是 model '%s' 尚未安装” % settings.AUTH_USER_MODEL - Python Django - "AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL django中的get_user_model(),settings.AUTH_USER_MODEL和USER之间有什么区别? - WHAT IS DIFFERENCE BETWEEN get_user_model() ,settings.AUTH_USER_MODEL and USER in django? Django 使用 get_user_model 与 settings.AUTH_USER_MODEL - Django using get_user_model vs settings.AUTH_USER_MODEL “AUTH_USER_MODEL 指的是尚未安装的 model '%s'” % settings.AUTH_USER_MODEL django.core.exceptions.ImproperlyConfigured: - “AUTH_USER_MODEL refers to model '%s' that has not been installed” % settings.AUTH_USER_MODEL django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL指的是尚未安装的模型'%s'“%设置。AUTH_USER_MODEL - AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL ValueError:无法为“作者”创建表单字段,因为尚未加载其相关模型“ settings.AUTH_USER_MODEL” - ValueError: Cannot create form field for 'author' yet, because its related model 'settings.AUTH_USER_MODEL' has not been loaded yet Django 设置文件中 AUTH_USER_MODEL 的值 - Value for AUTH_USER_MODEL in Django settings file 如何更新Standart Django模型(auth_user) - How to update standart Django model (auth_user)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM