Django项目中的Djangocms模板错误

2024-05-23 16:58:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图运行本地的老django1.4项目,我必须升级和进一步开发。服务器上一切正常。在我的本地,我用pip冻结服务器上的项目和pip安装设置了虚拟环境。项目使用的是django cms2.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文档中找到它。而且,这似乎不是http://example.com/URL的问题。当我将127.0.0.1:8000站点添加到数据库并在settings.py中设置相应的站点_ID时,仍然会发生错误。 我应该正确设置什么才能使它像在服务器上一样工作?在


Tags: the项目服务器idhomecms错误page