我正在尝试运行本地旧的Django 1.4项目,我必须升级并进一步开发。一切都在服务器上正常工作。在我的本地我已经使用服务器上的项目pip冻结和pip安装来设置虚拟环境。项目正在使用django-cms 2.3.8。打开127.0.0.0:8000会产生错误:
Template error:
In template /home/user/projects/mprj/src/project/templates/menu/main_menu.html, error at line 6
A template tag couldn''t find the page with lookup arguments `{'reverse_id': u'polls', 'site': 1}
`. The URL of the request was: http://example.com/
6 : <a href=" {% page_url "polls" %} " title="{% page_attribute "title" "polls" %}"> {% page_attribute "title" "polls" %} </a>
Traceback:
...
File "/home/user/.virtualenvs/mprj/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in get_context
115. page = _get_page_by_untyped_arg(page_lookup, request, site_id)
File "/home/user/.virtualenvs/mprj/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in _get_page_by_untyped_arg
86. raise Page.DoesNotExist(body)
Exception Type: DoesNotExist at /
Exception Value: A template tag couldn''t find the page with lookup arguments `{'reverse_id': u'polls', 'site': 1}
`. The URL of the request was: http://example.com/
{% page_url "polls" %}
发生错误。我不清楚,应该在哪里设置reverse_id
。我无法从django-cms docs中找到它。此外,它似乎不是http://example.com/网址的问题。当我将127.0.0.1:8000站点添加到数据库并在settings.py
中设置相应的SITE_ID时,仍会出现错误。
我应该正确设置什么才能让它像在服务器上一样工作?