我已经开发了一个wagtail网站,效果很好。这只是一个简单的博客。我能够在其下添加博客索引页面和博客文章。最近在尝试添加新页面时将鼠标悬停会显示错误
PathOverflow at /admin/pages/add/blog/blogpage/8/
下面是完整的追溯。
Environment:
Request Method: POST
Request URL: https://vikatakavi.info/admin/pages/add/blog/blogpage/8/
Django Version: 2.1.5
Python Version: 3.5.2
Installed Applications:
['home',
'search',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'modelcluster',
'taggit',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sitemaps',
'blog']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware']
Traceback:
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/wagtail/admin/urls/__init__.py" in wrapper
102. return view_func(request, *args, **kwargs)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/wagtail/admin/decorators.py" in decorated_view
34. return view_func(request, *args, **kwargs)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/wagtail/admin/views/pages.py" in create
224. parent_page.add_child(instance=page)
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/treebeard/mp_tree.py" in add_child
1013. return MP_AddChildHandler(self, **kwargs).process()
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/treebeard/mp_tree.py" in process
387. newobj.path = self.node.get_last_child()._inc_path()
File "/home/ubuntu/projects/blogger/env/lib/python3.5/site-packages/treebeard/mp_tree.py" in _inc_path
1114. raise PathOverflow(_("Path Overflow from: '%s'" % (self.path, )))
Exception Type: PathOverflow at /admin/pages/add/blog/blogpage/8/
Exception Value: Path Overflow from: '000100010005ZZZZ'
我对此一无所知。
答案 0 :(得分:3)
要将页面的位置存储在页面树中,Wagtail使用一种称为Materialized Path的技术(在其标准设置下)最多允许在树的特定点插入1679615。看来您已经达到了这个极限。 (树中每个点的位置表示为4个字符的字母数字代码;错误消息中显示的“ ZZZZ”是最高的可用代码。)
如果您有超过160万个博客帖子,那么您将遇到此限制,但是显然这不太可能。一种可能的可能性是您编写的导入或维护脚本正在执行大量的插入或页面移动-例如,如果您有一个脚本来随机地对页面进行重新排序,并且您正在以10000为单位的部分运行该脚本页,运行约160次后,索引号就会用完。
如果您确实无法避免达到此限制,那么可以通过在启动时运行的地方添加以下代码来将限制增加到6000万:
from wagtail.core.models import Page
Page.steplen = 5
但是,这不适用于现有数据库-进行此更改后,您需要删除并重新创建数据库-这意味着树的最大可能深度从63级减少到50级。