13

以下のように私のdjangoとuserenaパッケージを移行した後

Django 1.8 から Django 1.9.7 へ

django-userena 1.4.1 から 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アプリにいくつかの変更があると思いますが、理由がわかりません...この問題を解決するのに役立つ人はいますか?

前もって感謝します !

4

10 に答える 10

2

完全なトレースバックは、より適切な診断に役立ちます。一応、移行が原因で発生した依存関係の問題のように思えます。これについてDjangoのドキュメントが何を言わなければならないかを確認してください-

スワップ可能なモデルに対する Django の動的依存関係機能の制限により、AUTH_USER_MODEL によって参照されるモデルがそのアプリの最初の移行で作成されることを確認する必要があります (通常は 0001_initial と呼ばれます)。そうしないと、依存関係の問題が発生します。

リンクは次のとおりです-https://docs.djangoproject.com/en/1.9/topics/auth/customizing/

于 2016-07-05T12:50:49.420 に答える