DoesNotExist at /en-us/ A template tag couldn'

2019-07-14 03:38发布

I am currently going through the django-cms-demo. I have been using the code found here:

https://github.com/andrewschoen/django-cms-demo/tree/master/demo.

I had this working prior to adding the Poll app plugin. I had been getting reverse matching errors when I add the Poll app plugin in the django-admin. After a couple of fixes, I started getting the error below:

"A template tag couldn't find the page with lookup arguments {'reverse_id': u'home', 'site': 1}. The URL of the request was: 'http'://example.com/en-us/"

Traceback:

Environment:

Request Method: GET Request URL: 'http'://127.0.0.1:8888/en-us/

Django Version: 1.5.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'cms',
 'mptt',
 'menus',
 'south',
 'sekizai',
 'reversion',
 'cms.plugins.text',
 'polls',
 'filer',
 'easy_thumbnails',
 'cms.plugins.link',
 'cms.plugins.picture',
 'tinymce',
 'djangocms_column',
 'cmsplugin_filer_file',
 'cmsplugin_filer_image',
 'cmsplugin_filer_teaser',
 'cmsplugin_filer_folder',
 'cmsplugin_filer_video')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'cms.middleware.language.LanguageCookieMiddleware')

Template error: In template /home/vagrant/django_cms/demo_cms/templates/subpage_base.html, error at line 26 A template tag couldn't find the page with lookup arguments {'reverse_id': u'home', 'site': 1} . The URL of the request was: 'http'://example.com/en-us/ 16 :

17 : {% placeholder sidebar %}

18 :

19 :

20 : {% block sub_content %}{% endblock %}

21 :

22 :

23 : {% endblock %}

24 :

25 : {% block footer %}

26 : {% show_placeholder 'footer' 'home' %}

27 : {% endblock %}

28 :

29 :

Traceback: File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 140. response = response.render() File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/response.py" in render 105. self.content = self.rendered_content File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content 82. content = template.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in render 140. return self._render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in _render 134. return self.nodelist.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in render 830. bit = self.render_node(node, context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/debug.py" in render_node 74. return node.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render 124. return compiled_parent._render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in _render 134. return self.nodelist.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in render 830. bit = self.render_node(node, context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/debug.py" in render_node 74. return node.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render 124. return compiled_parent._render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in _render 134. return self.nodelist.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in render 830. bit = self.render_node(node, context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/debug.py" in render_node 74. return node.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/classytags/core.py" in render 106. return self.render_tag(context, **kwargs) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/sekizai/templatetags/sekizai_tags.py" in render_tag 76. rendered_contents = nodelist.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in render 830. bit = self.render_node(node, context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/debug.py" in render_node 74. return node.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render 63. result = block.nodelist.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/base.py" in render 830. bit = self.render_node(node, context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/django/template/debug.py" in render_node 74. return node.render(context) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/classytags/core.py" in render 106. return self.render_tag(context, **kwargs) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/classytags/helpers.py" in render_tag 75. data = self.get_context(context, **kwargs) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in get_context 468. return _show_placeholder_for_page(**self.get_kwargs(*args, **kwargs)) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in _show_placeholder_for_page 436. page = _get_page_by_untyped_arg(page_lookup, request, site_id) File "/home/vagrant/django_cms/local/lib/python2.7/site-packages/cms/templatetags/cms_tags.py" in _get_page_by_untyped_arg 107. raise Page.DoesNotExist(body)

Exception Type: DoesNotExist at /en-us/ Exception Value: A template tag couldn't find the page with lookup arguments {'reverse_id': u'home', 'site': 1} . The URL of the request was: 'http'://example.com/en-us/

标签: django-cms
1条回答
在下西门庆
2楼-- · 2019-07-14 04:13

change:

{% show_placeholder 'footer' 'home' %}

to:

{% show_placeholder 'footer' %}

Or add an id in your home page advanced settings called home

查看更多
登录 后发表回答