我正在使用Wagtail,一款轻量级的django CMS。我将Wagtail升级到0.8.6(Django从1.6.5升级到1.7.7),我有一个基本上显示新闻对象的列表:
http://localhost:8020/news/
它使用django的paginator,所以如果我尝试访问下一页:
http://localhost:8020/news/2/
我有一个错误:
ValueError at /news/2/
need more than 1 value to unpack
这是追溯:
Environment:
Request Method: GET
Request URL: http://localhost:8020/news/1/
Django Version: 1.7.7
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'raven.contrib.django.raven_compat',
'compressor',
'taggit',
'modelcluster',
'django.contrib.admin',
'preventconcurrentlogins',
'django_medusa',
'wagtail.wagtailcore',
'wagtail.wagtailadmin',
'wagtail.wagtaildocs',
'wagtail.wagtailsnippets',
'wagtail.wagtailusers',
'wagtail.wagtailimages',
'wagtail.wagtailembeds',
'wagtail.wagtailsearch',
'wagtail.wagtailredirects',
'wagtail.contrib.wagtailmedusa',
'myapp',
'django_extensions')
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',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'preventconcurrentlogins.middleware.PreventConcurrentLoginsMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware')
Traceback:
File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vagrant/venv/local/lib/python2.7/site-packages/wagtail/wagtailcore/views.py" in serve
20. page, args, kwargs = request.site.root_page.specific.route(request, path_components)
Exception Type: ValueError at /news/2/
Exception Value: need more than 1 value to unpack
任何可能导致这种情况的想法?
使用之前的设置(wagtail 0.5, Django 1.6.5
)它正在运行。
答案 0 :(得分:2)
您的新闻页面模式可能会有route()
方法返回HttpResponse。这被弃用了0.4,并且在0.6中完全删除了对它的支持:
http://docs.wagtail.io/en/stable/releases/0.4.html#page-route-method-should-now-return-a-routeresult
您需要将其重写为返回RouteResult对象的route()
方法,以及返回HttpResponse的单独serve()
方法,如下所述:
http://docs.wagtail.io/en/stable/core_components/pages/model_recipes.html#overriding-route-method