Django列wagtailcore_page.draft_title不存在

时间:2017-07-30 05:50:42

标签: django django-models django-templates wagtail

Django == 1.11.3,wagtail == 1.11.1

我在远程服务器上备份了我的PostgreSQL,并在我的本地服务器上进行了恢复,因此我可以获得所有更改的精确副本。我已经用这种方式做了很长时间,它总是像魅力一样。但是这一次,我做了恢复并得到了以下错误:

column wagtailcore_page.draft_title does not exist LINE 1: ...ore_page"."numchild", "wagtailcore_page"."title", "wagtailco...

我删除了我的数据库并恢复了新鲜但却没有做任何事情。我删除了所有迁移,执行--fake迁移以尝试重置,但没有删除;仍然得到错误。我对此感到茫然,可以使用一些反馈。谢谢。

这是我的跟踪文件:

Environment:


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

Django Version: 1.11.3
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',
 'wagtail.contrib.table_block']
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/backends/utils.py" in execute
  65.                 return self.cursor.execute(sql, params)

The above exception (column wagtailcore_page.draft_title does not exist
LINE 1: ...ore_page"."numchild", "wagtailcore_page"."title", "wagtailco...
                                                             ^
) 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
  244.             response = middleware_method(request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailcore/middleware.py" in process_request
  20.             request.site = Site.find_for_request(request)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailcore/models.py" in find_for_request
  129.         return get_site_for_hostname(hostname, port)

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/wagtail/wagtailcore/sites.py" in get_site_for_hostname
  38.         'root_page'

File "/Users/rooster/.pyenv/versions/3.5.0/envs/alpha_omega/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
  250.         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
  1118.             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 /
Exception Value: column wagtailcore_page.draft_title does not exist
LINE 1: ...ore_page"."numchild", "wagtailcore_page"."title", "wagtailco...
                                                             ^

2 个答案:

答案 0 :(得分:1)

恢复数据库备份后,您需要运行./manage.py migrate。在Wagtail 1.11中添加了draft_title,因此可能您的备份来自运行Wagtail 1.10或更早版本的站点。

(正在运行--fake与您想要的相反...它告诉Django 运行任何未完成的迁移,包括添加draft_title的迁移列。)

答案 1 :(得分:1)

错误是由于您没有迁移最新版本的wagtail。只需运行python manage.py migrate,当您看到它正在运行时,就会显示:

Running migrations:
Rendering model states ... DONE
Applying 
wagtailcore.0040_page_draft_title 
... OK

重新运行您的项目,您已完成。