我在新安装的django-cms上遇到了一些问题。基本django系统位于我的主目录中。 Gunicorn使用以下.htaccess
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteBase /
RewriteRule ^(.*)$ http://127.0.0.1:64367/$1 [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 %}
...
我的设置中的问题在哪里? 错误信息更长,但这可能是足够的信息。
答案 0 :(得分:1)
正如你在这一行中所看到的那样
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
中使用语言名称中的大写字母