How to find django template errors?

I have a template that is not parsed - instead of django, it appears:

TemplateSyntaxError: Could not parse the remainder: '"{%' from '"{%'

Unfortunately, Django does not reveal where the error is. Is there a tool that can reveal the location of syntax errors in Django templates?

+3
source share
3 answers

The interactive debugger in django-extensions runserver_pluswill simplify the introspection of the node content template and template source, as well as how to look at context variables.

In addition, make sure that templatetag is importable and does not cause errors.

Unfortunately, I am not making this easier.

+2
source

Good question, you can check the error tracing again:

  • - node, . node node
  • , tracestack - .
    • 'nodelist' - node.
    • 'compiled_result' - , node ( TextNode)

, ,

{% block foo %}{{ "{% }} 

tracestack, "" ,

nodelist      []

, node foo.

+2

Don't think this tells you the exact location, but the Django Debug Tool panel can help here to some extent.

https://github.com/django-debug-toolbar/django-debug-toolbar

tour http://vimeo.com/6640136

0
source

All Articles