Skip to content Skip to sidebar Skip to footer

How To Debug Jinja2 Template?

I am using jinja2 template system into django. It is really fast and I like it a lot. Nevertheless, I have some problem to debug templates : If I make some errors into a template (

Solution 1:

After doing some more test, I found the answer :

By doing the same template test, directly under python, without using django, debug messages are present. So it comes from django.

The fix is in settings.py : One have to set DEBUG to True AND set TEMPLATE_DEBUG to False.

Solution 2:

From the Jinja2 Documentation:

My tracebacks look weird. What’s happening?

If the speedups module is not compiled and you are using a Python installation without ctypes (Python 2.4 without ctypes, Jython or Google’s AppEngine) Jinja2 is unable to provide correct debugging information and the traceback may be incomplete. There is currently no good workaround for Jython or the AppEngine as ctypes is unavailable there and it’s not possible to use the speedups extension.

http://jinja.pocoo.org/2/documentation/faq#my-tracebacks-look-weird-what-s-happening

Post a Comment for "How To Debug Jinja2 Template?"