gpt4 book ai didi

django.core.exceptions.ImproperlyConfigured : AUTH_USER_MODEL refers to model 'auth.User' that has not been installed

转载 作者:行者123 更新时间:2023-12-03 20:56:42 27 4
gpt4 key购买 nike

迁移我的 django 和 userena 包后,如下所示

Django 1.8 to Django 1.9.7

django-userena 1.4.1 to django-userena==2.0.1



运行项目后,我遇到了这个错误
Unhandled exception in thread started by <function wrapper at 0xb689641c>
Traceback (most recent call last):
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
for pattern in resolver.url_patterns:
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/Documents/swamy/sample_project/july/5/sample11/sampleapp/urls.py", line 28, in <module>
(r'^grappelli/', include('grappelli.urls')),
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 52, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/grappelli/urls.py", line 8, in <module>
from .views.switch import switch_user
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/grappelli/views/switch.py", line 18, in <module>
User = get_user_model()
File "/home/Documents/environments/venv/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 155, in get_user_model
"AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL

django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL 指的是尚未安装的模型“auth.User”

这是我的设置文件中的 INSTALLED_APPS,
'grappelli.dashboard',
'grappelli',
'filebrowser',
'django.contrib.admindocs',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.redirects',
'django.contrib.sitemaps',
'haystack',
'memcache_status',
'stheme',
'home',
'customers',
'orders',
#'legacy',
'products',
'bloglets',
'utils',
'catax',
'sqls',
'quotes',
#'django_stylus',
#'djgrid',
#'obdjects',
'quickpages',
'loginas',
#'pyjade',
'django_countries',
'debug_toolbar',
'djide',
#'dbtemplates',
#'aloha', # out temporarily, migrate to alternate https://github.com/ntucker/django-aloha-edit - JJW
'coffeescript',
'django_wysiwyg',
#'django_bfm',
'userena',
'guardian',
#'apps',
#'filer',
'easy_thumbnails',
'taggit',
#'taggit_templatetags',
# 'social_auth',
'social.apps.django_app.default',
#'socialregistration',
#'socialregistration.contrib.linkedin',
'email_extras',
#'csvimport',
'csvimport.app.CSVImportConf',
'django_extensions',
'webshell',
'easy_select2',
#'plata',
#'plata.contact',
#'plata.discount',
#'plata.payment',
#'plata.shop',
'lastmodule',

我猜python应用程序有一些变化。但我找不到原因......有没有人帮助解决这个问题?

提前致谢!

最佳答案

这个问题通常存在于两个原因之间。

  • 当已安装应用程序中的依赖项顺序颠倒时。
  • 当您根本没有提到已安装应用程序中的依赖项时。

  • 在这种情况下,grappelli 似乎提出了这个问题,告诉 auth.User没有找到。这意味着它无法找到任何包 auth .如果您使用默认用户模型,请删除 AUTH_USER_MODEL从配置中进行设置,或者如果您在包“auth”中使用任何自定义用户模型,请在已安装的应用程序中列出它。

    关于django.core.exceptions.ImproperlyConfigured : AUTH_USER_MODEL refers to model 'auth.User' that has not been installed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38203301/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com