模板渲染期间的 django cms 错误 cms_toolbar
django cms Error during Template rendering cms_toolbar
我新安装的 django-cms 有一些问题。基础 django 系统位于我的主目录中。 Gunicorn 使用以下 .htaccess
:
部署所有内容
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteBase /
RewriteRule ^(.*)$ http://127.0.0.1:64367/ [P]
RequestHeader set X-Forwarded-Proto https env=HTTPS
在我的浏览器中访问主页时,该页面几乎可以正常工作。但是当以管理员身份登录并重新加载主页时,出现以下错误:
NoReverseMatch at /en-us/
Reverse for 'cms_page_unpublish' with arguments '(1, 'en-US')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['en-us/admin/cms/page/([0-9]+)/([a-z\-]+)/unpublish/$']
Request Method: GET
Request URL: http://www.hg3n.com/en-us/
Django Version: 1.8.7
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'cms_page_unpublish' with arguments '(1, 'en-US')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['en-us/admin/cms/page/([0-9]+)/([a-z\-]+)/unpublish/$']
Exception Location: /home/hg3n/env/django-cms/lib/python3.4/site-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 495
Python Executable: /home/hg3n/env/django-cms/bin/python3.4
Python Version: 3.4.3
Python Path:
['/home/hg3n/django-cms',
'/home/hg3n/env/django-cms/bin',
'/home/hg3n/env/django-cms/lib/python34.zip',
'/home/hg3n/env/django-cms/lib/python3.4',
'/home/hg3n/env/django-cms/lib/python3.4/plat-linux',
'/home/hg3n/env/django-cms/lib/python3.4/lib-dynload',
'/package/host/localhost/python-3.4.3/lib/python3.4',
'/package/host/localhost/python-3.4.3/lib/python3.4/plat-linux',
'/home/hg3n/env/django-cms/lib/python3.4/site-packages']
Server time: Fri, 25 Dec 2015 21:49:18 +0100
此时:
Error during template rendering
...
{% cms_toolbar %}
...
我的设置哪里有问题?
错误消息更长,但也许这些信息就足够了。
正如您在这一行中看到的那样
Reverse for 'cms_page_unpublish' with arguments '(1, 'en-US')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['en-us/admin/cms/page/([0-9]+)/([a-z\-]+)/unpublish/$']
当唯一尝试过的 ulr 模板以 'en-us' 开头时,cms_page_unpublish 的参数包括 'en-US'。确保您没有在 settings.py
中的语言名称中使用大写字母
我新安装的 django-cms 有一些问题。基础 django 系统位于我的主目录中。 Gunicorn 使用以下 .htaccess
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteBase /
RewriteRule ^(.*)$ http://127.0.0.1:64367/ [P]
RequestHeader set X-Forwarded-Proto https env=HTTPS
在我的浏览器中访问主页时,该页面几乎可以正常工作。但是当以管理员身份登录并重新加载主页时,出现以下错误:
NoReverseMatch at /en-us/
Reverse for 'cms_page_unpublish' with arguments '(1, 'en-US')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['en-us/admin/cms/page/([0-9]+)/([a-z\-]+)/unpublish/$']
Request Method: GET
Request URL: http://www.hg3n.com/en-us/
Django Version: 1.8.7
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'cms_page_unpublish' with arguments '(1, 'en-US')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['en-us/admin/cms/page/([0-9]+)/([a-z\-]+)/unpublish/$']
Exception Location: /home/hg3n/env/django-cms/lib/python3.4/site-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 495
Python Executable: /home/hg3n/env/django-cms/bin/python3.4
Python Version: 3.4.3
Python Path:
['/home/hg3n/django-cms',
'/home/hg3n/env/django-cms/bin',
'/home/hg3n/env/django-cms/lib/python34.zip',
'/home/hg3n/env/django-cms/lib/python3.4',
'/home/hg3n/env/django-cms/lib/python3.4/plat-linux',
'/home/hg3n/env/django-cms/lib/python3.4/lib-dynload',
'/package/host/localhost/python-3.4.3/lib/python3.4',
'/package/host/localhost/python-3.4.3/lib/python3.4/plat-linux',
'/home/hg3n/env/django-cms/lib/python3.4/site-packages']
Server time: Fri, 25 Dec 2015 21:49:18 +0100
此时:
Error during template rendering
...
{% cms_toolbar %}
...
我的设置哪里有问题? 错误消息更长,但也许这些信息就足够了。
正如您在这一行中看到的那样
Reverse for 'cms_page_unpublish' with arguments '(1, 'en-US')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['en-us/admin/cms/page/([0-9]+)/([a-z\-]+)/unpublish/$']
当唯一尝试过的 ulr 模板以 'en-us' 开头时,cms_page_unpublish 的参数包括 'en-US'。确保您没有在 settings.py
中的语言名称中使用大写字母