【问题标题】:AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODELAUTH_USER_MODEL 指的是尚未安装的模型 '%s'" % settings.AUTH_USER_MODEL
【发布时间】:2016-05-04 13:02:43
【问题描述】:

这是我的设置。

    ########## APP CONFIGURATION
DJANGO_APPS = (
    # Default Django apps:
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # Useful template tags:
    # 'django.contrib.humanize',

    # Admin panel and documentation:
    'django.contrib.admin',
    # 'django.contrib.admindocs',
)

THIRD_PARTY_APPS = (
    'south',
    'colorful',
    #'grappelli',
    'django_extensions',
    #'rest_framework',
    #'sorl.thumbnail',
    'guardian',
    'sslserver',
    'djangosecure',
    'django_nose',
)

# Apps specific for this project go here.
LOCAL_APPS = (
    'main',
    'executor',
    'workshop',
    'management',
)

这是我加载的 python 应用程序:

    Django < 1.7
South === 1.0
django-colorful
django-extensions == 1.5.2
django-mptt == 0.7.4
loremipsum < 1.0.4
django_debug_toolbar
werkzeug == 0.11.4
Pillow == 3.1.1
MySQL-python
xlwt
xlrd
django-guardian == 1.3.2
lxml
fabric
django-fab-deploy
django-secure === 1.0.1
django-sslserver === 0.15
python-ldap === 2.4.19
django_auth_ldap
html2text
htmlentities
openpyxl
raven
colorful
ipython == 4.1.1
django-nose
newrelic

我没有进行任何代码更改,现在我无法创建或更新实例。我将在服务器中收到此错误消息:

    File "/srv/www/lohja/targetor/env/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 129, in get_user_model
[targetor_upgrade@targetorpro.fi] out:
raise ImproperlyConfigured("AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL)
[targetor_upgrade@targetorpro.fi] out:
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'executor.ExecutorUser' that has not been installed
[targetor_upgrade@targetorpro.fi] out:
Fatal error: run() received nonzero return code 1 while executing!
Requested: /srv/www/lohja/targetor/env/bin/python /srv/www/lohja/targetor/manage.py migrate --fake --no-initial-data guardian --settings=settings.local_setti$
Executed: /bin/bash -l -c "cd /srv/www/lohja/targetor/env/bin/ && . /srv/www/lohja/targetor/env/bin/activate && /srv/www/lohja/targetor/env/bin/python /srv/w$
Aborting.

我猜 python 应用程序中有一些更改会导致此错误。但我找不到我必须使用的某些应用程序的哪个版本。我已经遇到过这种问题,但设法解决了这些问题。现在,我找不到原因......还有其他人解决这个问题吗?

【问题讨论】:

  • executor.ExecutorUser 未找到
  • 实际 INSTALLED_APPS 设置在哪里?它是否结合了所有 DJANGO_APPS、THIRD_PARTY_APPS 和 LOCAL_APPS?
  • # 请参阅:docs.djangoproject.com/en/dev/ref/settings/#installed-apps INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS ########## END APP 配置
  • 其实是“'executor.ExecutorUser'还没有安装”。我没有对代码进行任何更改,并且我设法在 2016 年 4 月 23 日更新了实例。现在,我不能!那么改变了什么?为什么这些应用程序不再正常运行?我应该使用哪些版本来修复此错误?
  • 解决了没有?

标签: python django


【解决方案1】:

可能是由于缺少 django 确保已安装所有要求。如果您使用的是 VirtualEnv,请确保在使用 manage.py 启动服务器之前激活

【讨论】:

  • 首先有 django
猜你喜欢
  • 1970-01-01
  • 2019-09-30
  • 1970-01-01
  • 2015-01-10
  • 1970-01-01
  • 1970-01-01
  • 2021-10-07
  • 2021-07-12
  • 2019-06-27
相关资源
最近更新 更多