简体   繁体   English

cms模板中断页面中的Django-cms占位符

[英]Django-cms placeholder in cms template breaks page

So I moved my cms templates to a /cms folder in the templates folder: 因此,我将cms模板移到了templates文件夹中的/ cms文件夹中:

templates/cms/default_template.html template / cms / default_template.html

I edited the settings.py as follows: 我对settings.py进行了如下编辑:

CMS_TEMPLATES = (
    ('cms/default_template.html', 'Default Template'),
)

My template looks like this: 我的模板如下所示:

{% extends "base.html" %}
{% load cms_tags %}

{% block base_content %}
    {% placeholder template_1_content %}
{% endblock %}

Problem is it throws the following error on page load: 问题是它在页面加载时引发以下错误:

TemplateDoesNotExist at /en/ TemplateDoesNotExist位于/​​ en /

Error during template rendering 模板渲染期间发生错误

3   
4   {% block base_content %}
5   ***{% placeholder template_1_content %}*** -> This line is red indicating the problem is here
6   {% endblock %}

If I remove the {% placeholder template_1_content %} the page loads fine no problems. 如果我删除了{%placeholder template_1_content%},则页面加载不会有任何问题。 It's only after adding that placeholder that it goes bonkers for no reason I can think of. 只有在添加了占位符之后,它才变得毫无意义。

Has anyone seen something like this before? 有人看过类似的东西吗?

BTW the page will load with the placeholder if I don't use the /cms folder. 顺便说一句,如果我不使用/ cms文件夹,则该页面将使用占位符加载。 So what is it about the placeholder and the folder location??? 那么占位符和文件夹位置是什么呢???

Any help would be appreciated. 任何帮助,将不胜感激。

I figured it out. 我想到了。 Turns out the name of the first template created was stored in the database and that was being referenced. 原来创建的第一个模板的名称已存储在数据库中,并且已被引用。 I had to manually edit the database to the new location and name of the template 我必须手动将数据库编辑到模板的新位置和名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM