Django Wagail错误:列wagtailusers_userprofile.preferred_language不存在

时间:2017-06-12 00:28:06

标签: django wagtail

我将Wagtail升级到版本1.10.1,现在当我尝试登录管理员时出现column wagtailusers_userprofile.preferred_language does not exist错误。错误似乎很明显,但我不确定如何解决它;我认为Wagtail升级会处理它。以下是追溯。谢谢。

    Environment:


Request Method: GET
Request URL: http://127.0.0.1:8001/admin/

Django Version: 1.11.2
Python Version: 3.5.0
Installed Applications:
['app',
 'home',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'django_summernote',
 'rest_framework',
 'wagtail.contrib.settings',
 'wagtail.contrib.modeladmin',
 'wagtail.wagtailcore',
 'wagtail.wagtailadmin',
 'wagtail.wagtaildocs',
 'wagtail.wagtailsnippets',
 'wagtail.wagtailusers',
 'wagtail.wagtailimages',
 'wagtail.wagtailembeds',
 'wagtail.wagtailsearch',
 'wagtail.wagtailsites',
 'wagtail.wagtailredirects',
 'wagtail.wagtailforms',
 'wagtail.contrib.wagtailsitemaps',
 'wagtail.contrib.wagtailroutablepage',
 'wagtail.contrib.wagtailstyleguide',
 'wagtailmenus',
 'compressor',
 'taggit',
 'modelcluster',
 'docs']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'wagtail.wagtailcore.middleware.SiteMiddleware',
 'wagtail.wagtailredirects.middleware.RedirectMiddleware']



Traceback:

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/fields/related_descriptors.py" in __get__
  385.             rel_obj = getattr(instance, self.cache_name)

During handling of the above exception ('User' object has no attribute '_wagtail_userprofile_cache'), another exception occurred:

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  65.                 return self.cursor.execute(sql, params)

The above exception (column wagtailusers_userprofile.preferred_language does not exist
LINE 1: ...gtailusers_userprofile"."rejected_notifications", "wagtailus...
                                                             ^
) was the direct cause of the following exception:

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/views/decorators/cache.py" in _cache_controlled
  43.             response = viewfunc(request, *args, **kw)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailadmin/decorators.py" in decorated_view
  25.             if hasattr(user, 'wagtail_userprofile'):

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/utils/functional.py" in inner
  239.         return func(self._wrapped, *args)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/fields/related_descriptors.py" in __get__
  393.                     rel_obj = self.get_queryset(instance=instance).get(**filter_args)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in get
  374.         num = len(clone)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __len__
  232.         self._fetch_all()

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
  1105.             self._result_cache = list(self._iterable_class(self))

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
  53.         results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
  886.             raise original_exception

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
  876.             cursor.execute(sql, params)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  80.             return super(CursorDebugWrapper, self).execute(sql, params)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  65.                 return self.cursor.execute(sql, params)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/utils.py" in __exit__
  94.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/utils/six.py" in reraise
  685.             raise value.with_traceback(tb)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  65.                 return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /admin/
Exception Value: column wagtailusers_userprofile.preferred_language does not exist
LINE 1: ...gtailusers_userprofile"."rejected_notifications", "wagtailus...

1 个答案:

答案 0 :(得分:2)

您需要运行./manage.py migrate