[英]What does 'Template error at line 0' mean in django?
I have got an error on a django site that i am working on which is a zero division error. 我在django网站上遇到错误,这是零除错误。 I couldn't find the source of the error which I am thinking that is because of likely mathfilter but still not sure. 我找不到错误的原因,我认为这是由于可能存在mathfilter,但仍不确定。
What I am asking here is that django gives that error with saying it occurs at line 0 which I don't know what that exactly mean. 我在这里要问的是django给出了这个错误,说它发生在第0行,我不知道那是什么意思。
This is the beginning of the template file: 这是模板文件的开头:
1 {% extends "main.html" %}
2 {% include "ru.html" %}
3 {% load staticfiles %}
4 {% load mathfilters %}
5 {% load humanize %}
Only thing that occurs to me when I see this (error at line 0) is that to look at the main.html file. 看到此错误(第0行错误)时,发生在我身上的唯一事情就是查看main.html文件。 But I couldn't find anything that might cause this zero division error. 但是我找不到任何可能导致此零除错误的东西。
IMHO, this has nothing to deal with divide by zero , this is a reverse URL misfunction. 恕我直言,这与零除无关,这是一个反向URL功能。
While debugging, I had different line numbers : 0, 13, 15, etc… each time the line mentioned had no bad reverse URL call. 调试时,我有不同的行号:0、13、15等……每次提到的行都没有不好的反向URL调用。
I had this message : 我收到此消息:
Error during template rendering
In template …project/templates/base.html, error at line 0
Reverse for 'search' not found. 'search' is not a valid view function or pattern name.
How I solve it : 我如何解决:
search
, specially in a {% url 'search' %}
tag 在我使用search
文件中search
,特别是在{% url 'search' %}
标记中 url.py
), in my case it was foo-search
) 用良好的URL名称(在应用程序url.py
定义)重命名标签,在我的情况下为foo-search
) 当除法或模运算的第二个参数为零时,将引发ZeroDivisionError异常。“ main.html”文件或链接该文件的其他文件中必须有这样的表达式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.