Wagtail:无法导入名称页面

时间:2017-10-20 19:43:54

标签: django wagtail

我正在使用Vagrant进行虚拟化,一切正常,直到今天,当我的朋友克隆了一个在我的计算机上工作正常的repo时,他开始无法导入名称页面

Environment:

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

Django Version: 1.8.14
Python Version: 2.7.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.humanize',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'compressor',
 'django_common',
 'djrill',
 'taggit',
 'modelcluster',
 'wagtail.wagtailcore',
 'wagtail.wagtailadmin',
 'wagtail.wagtaildocs',
 'wagtail.wagtailsnippets',
 'wagtail.wagtailusers',
 'wagtail.wagtailimages',
 'wagtail.wagtailembeds',
 'wagtail.wagtailsearch',
 'wagtail.wagtailredirects',
 'wagtail.wagtailforms',
 'wagtail.wagtailsites',
 'wagtail.contrib.wagtailsitemaps',
 'wagtail.contrib.wagtailfrontendcache',
 'django.contrib.gis',
 'froala_editor',
 'dal',
 'dal_select2',
 'home',
 'accounts',
 'ads',
 'staff',
 'common',
 'search',
 'blog',
 'article',
 'center',
 'slideshow',
 'legacy',
 'django_quiz',
 'django_quiz.essay',
 'django_quiz.quiz',
 'django_quiz.multichoice',
 'django_quiz.true_false',
 'polls',
 'wagtailoverrides',
 'rate_system',
 'dovescore_system',
 'social_django',
 'django_extensions',
 'wagtail.contrib.wagtailstyleguide']
Installed Middleware:
['django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'social_django.middleware.SocialAuthExceptionMiddleware',
 'wagtail.wagtailcore.middleware.SiteMiddleware',
 'wagtail.wagtailredirects.middleware.RedirectMiddleware']


Traceback:
File "/home/vagrant/webapps/dovemed/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  119.                 resolver_match = resolver.resolve(request.path_info)
File "/home/vagrant/webapps/dovemed/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  365.             for pattern in self.url_patterns:
File "/home/vagrant/webapps/dovemed/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  401.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/vagrant/webapps/dovemed/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  395.             self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)
File "/vagrant/dovemed/dovemed/urls.py" in <module>
  14. from wagtail.wagtailadmin import urls as wagtailadmin_urls
File "/home/vagrant/webapps/dovemed/local/lib/python2.7/site-packages/wagtail/wagtailadmin/urls/__init__.py" in <module>
  4. from wagtail.wagtailadmin.urls import pages as wagtailadmin_pages_urls

Exception Type: ImportError at /
Exception Value: cannot import name pages

我使用wagtail 1.8和django 1.8.14

1 个答案:

答案 0 :(得分:1)

我相信你可以通过添加:

来解决这个问题
djangorestframework>=3.1.3,<3.7

到您的requirements.txt(然后重新运行pip install -r requirements.txt)。

看起来错误的根本原因是:

/home/vagrant/webapps/dovemed/local/lib/python2.7/site-pack‌​ages/rest_framework/‌​serializers.py in <module>()
AttributeError: 'module' object has no attribute 'JSONField'

这是因为django-rest-framework 3.7(2017-10-06发布)放弃了对Django 1.8 / 1.9的支持,现在依赖于JSONField等Django 1.10功能。理想情况下,Wagtail应该将django-rest-framework固定为&lt; 3.7以防止安装不兼容的版本,但Wagtail版本高达1.12不会这样做 - 因此有必要在您的requirements.txt中指定它。