Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.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出现运行时错误?_Django_Django Views - Fatal编程技术网

什么会导致视图中django出现运行时错误?

什么会导致视图中django出现运行时错误?,django,django-views,Django,Django Views,什么会导致视图中django出现运行时错误 (对不起,这不是一个好问题。我有点不知道如何解决这个问题,甚至不知道如何构建一个问题。) 当我访问其中一个视图时,会出现运行时错误 RuntimeError at / maximum recursion depth exceeded Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.4.3 Exception Type: RuntimeError E

什么会导致视图中django出现运行时错误

(对不起,这不是一个好问题。我有点不知道如何解决这个问题,甚至不知道如何构建一个问题。)

当我访问其中一个视图时,会出现运行时错误

RuntimeError at /
maximum recursion depth exceeded
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.4.3
Exception Type: RuntimeError
Exception Value:    
maximum recursion depth exceeded
Exception Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py in compile_string, line 151
Python Executable:  /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python



  145.             t = get_template(template_path)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py" in get_template
  145.     template, origin = find_template(template_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py" in get_template_from_string
  156.     return Template(source, origin, name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in __init__
  125.         self.nodelist = compile_string(template_string, origin)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in compile_string
  151.     lexer = lexer_class(template_string, origin)

Exception Type: RuntimeError at /
Exception Value: maximum recursion depth exceeded

您正在进行一个未完成的递归调用。你能发布你的视图代码吗?基于被截断的堆栈跟踪,我认为这可能是一个递归模板的情况,因此视图代码可能不会提供有用的信息。在散步之后,当我回来时,看到你的两条评论真是太好了。我更认真地看了看模板。谢谢@PeterRowell。所以,这是一个递归模板的情况,因为我犯了一个愚蠢的错误。我在模板文件的顶部添加了一个描述。评论中包含了如何使用它,包括一个模板标签。错误是我使用了javascript注释(aka.)而不是Django注释(aka:{%comment%}{%endcomment%}.aah!使用Coda 2,所以我为Django模板抓取了一个语法高亮器,所以我不会忽略这样的错误。@wintour:使用JS注释?:-)我自己做过。这是真的:语法着色编辑器可以让你的生活轻松很多。