HTML更改未在django-cms中反映出来

时间:2022-09-04 08:22:20

I was working on an old django-cms project and was trying to edit base.html file and no changes are reflected when I reload the page.

我正在开发一个旧的django-cms项目,并且正在尝试编辑base.html文件,当我重新加载页面时没有反映出任何变化。

But if I delete all the lines in that file the django runserver refuses to start showing error

但是如果我删除该文件中的所有行,django runserver就会拒绝开始显示错误

django.core.exceptions.ImproperlyConfigured: The 'js' and 'css' sekizai namespaces must be present in each template, - or a template it inherits from - defined in CMS_TEMPLATES. I can't find the namespaces in 'project/cms/home.html'.

They why isn't other changes like adding a new class not reflected in the page reload or server restart.

他们为什么没有其他更改,如添加新的类没有反映在页面重新加载或服务器重新启动。

NOTE: The project is working good as it is. I was trying to modify it a little bit. Changes I made in the css pages are getting reflected when I reload the page. Issue is only when I try to edit HTML pages

注意:项目工作正常。我试图稍微修改一下。当我重新加载页面时,我在css页面中所做的更改会得到反映。问题仅在我尝试编辑HTML页面时

1 个解决方案

#1


1  

For base.html, you need to have {% load cms_tags sekizai_tags %} in the file. Add {% render_block "css" %} to <head></head> and {% render_block "js" %} somewhere between <body></body>. Depending on the template files that inherit from base.html, certain portions may have been overwritten. For example, if you had:

对于base.html,您需要在文件中包含{%load cms_tags sekizai_tags%}。将{%render_block“css”%}添加到 ,将{%render_block“js”%}添加到 之间。根据从base.html继承的模板文件,某些部分可能已被覆盖。例如,如果你有:

{# base.html #}
{% block content %}
    <div class="example-class"></div>
{% endblock %}

But in another file say:

但在另一个文件中说:

{# layout.html #}
{% extends "base.html" %}
{% block content %}
{% endblock %}

The div would not appear.

div不会出现。

If however, you are talking about missing CSS files, you still need to include them in <head> for it to be displayed. render_block "css" is for django-cms css files that are included in plugins etc. I usually use a LESS or SCSS compiler to include CSS into my projects.

但是,如果您正在讨论缺少CSS文件,则仍需要将它们包含在中以便显示它。 render_block“css”用于插件中包含的django-cms css文件等。我通常使用LESS或SCSS编译器将CSS包含到我的项目中。

Hope that helps. Post more details for a better diagnosis.

希望有所帮助。发布更多细节以获得更好的诊断。

#1


1  

For base.html, you need to have {% load cms_tags sekizai_tags %} in the file. Add {% render_block "css" %} to <head></head> and {% render_block "js" %} somewhere between <body></body>. Depending on the template files that inherit from base.html, certain portions may have been overwritten. For example, if you had:

对于base.html,您需要在文件中包含{%load cms_tags sekizai_tags%}。将{%render_block“css”%}添加到 ,将{%render_block“js”%}添加到 之间。根据从base.html继承的模板文件,某些部分可能已被覆盖。例如,如果你有:

{# base.html #}
{% block content %}
    <div class="example-class"></div>
{% endblock %}

But in another file say:

但在另一个文件中说:

{# layout.html #}
{% extends "base.html" %}
{% block content %}
{% endblock %}

The div would not appear.

div不会出现。

If however, you are talking about missing CSS files, you still need to include them in <head> for it to be displayed. render_block "css" is for django-cms css files that are included in plugins etc. I usually use a LESS or SCSS compiler to include CSS into my projects.

但是,如果您正在讨论缺少CSS文件,则仍需要将它们包含在中以便显示它。 render_block“css”用于插件中包含的django-cms css文件等。我通常使用LESS或SCSS编译器将CSS包含到我的项目中。

Hope that helps. Post more details for a better diagnosis.

希望有所帮助。发布更多细节以获得更好的诊断。