Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法注释掉django html文件中的python代码?_Python_Html_Django - Fatal编程技术网

有没有办法注释掉django html文件中的python代码?

有没有办法注释掉django html文件中的python代码?,python,html,django,Python,Html,Django,我很好奇,我有下面的代码{%code\u goes\u here%},我如何在html文件中注释它?这就是你要找的 Django模板将{#…#}作为注释。注意:这些评论不是多行的。正如其他人在回答中提到的那样,模板中有多种评论方式,所以我想我会在下面快速总结它们: 如上所述,您可以使用HTML注释 但是注释将显示用户是否查看了页面的源代码 对于模板中的单行注释,请使用: 对于模板中的多行注释,请使用: {% comment %} {% code_goes_here %} {% endcomme

我很好奇,我有下面的代码
{%code\u goes\u here%}
,我如何在html文件中注释它?

这就是你要找的

Django模板将
{#…#}
作为注释。注意:这些评论不是多行的。

正如其他人在回答中提到的那样,模板中有多种评论方式,所以我想我会在下面快速总结它们:

如上所述,您可以使用HTML注释
但是注释将显示用户是否查看了页面的源代码

对于模板中的单行注释,请使用:

对于模板中的多行注释,请使用:

{% comment %}
{% code_goes_here %}
{% endcomment %}

我不确定我是否理解这个问题,但它只是一句话,为什么不抄写相关的段落呢?
{# Your comment goes here,which will not be seen in template #}