debugging.txt
This file
Path
docs/src/debugging.txt
32 lines · 1.4 KiB
Last changed by
some more doc changes in jinja for the upcoming releaseArmin Ronacherbefore adoption825e522
History of this fileTake it
1===================2Debugging Templates3===================45In order to keep templates debuggable you have to do some additional work on6the application side. The traceback module that comes with python currently7does not support the `__loader__` hook which is used by Jinja to provide8templates. Although the import system was implemented three Python versions9ago the default traceback system still doesn't support it.1011However most of the extended web development traceback modules have support12for `__loader__`. Either directly or via the linecache module:1314- `Werkzeug Debugging Middleware`_15- `Django`_16- `cgitb`_17- `EvalException`_1819To enable debugging you have to use one of those debugging systems or20implement your own one with support for `__loader__`.2122The python implementation of the jinja debugger can only translate the first23exception in a traceback which can lead to problematic results. If you have24the extended debugger c extension compiled (default on unix systems but only25available on Windows if you have a VisualStudio 2003 installation) all frames26in the traceback will point to the correct linenumbers of the templates.272829.. _Werkzeug Debugging Middleware: http://werkzeug.pocoo.org/30.. _Django: http://www.djangoproject.com/31.. _cgitb: http://docs.python.org/lib/module-cgitb.html32.. _EvalException: http://pythonpaste.org/module-paste.evalexception.html