[wingide-users] debugging Jinja2 templates within Django

Wingware Support support at wingware.com
Fri Mar 7 10:28:25 EST 2014


Chris Curvey wrote:
> I finally got around to trying out the Jinja2 templating system to 
> replace the stock Django templating system, and I'm hooked!  Jinja2 
> performs better, and the templating language just feels nicer to me.
>
> But I'm not having much luck getting Wing to stop on breakpoints 
> within a jinja2 template.  Has anyone else had any luck?
>
> I've currently got my stock templates in files named "foo.html" and 
> the corresponding jinja version in "foo.jinja"
>
> I think when I installed the django-jinja package (which is the glue 
> that makes Django and Jinja work together, much like "coffin") it 
> installed the C-language speedups when it installed the MarkupSafe 
> package.  Not sure if I need to remove that C-language stuff to get 
> debugging working.  (or even *how* to uninstall it, frankly)
>
> any clues appreciated!

The ability to stop in Django templates is very specific to the 
implementation of the Django template engine.  Similar support would 
have to be written for Jinja, also specific to its implementation.  
Basically, we defined a mapping from the Python stack frames to template 
frames and swap out some frames before they are reported to the IDE.  
There's no guarantee this is possible to implement cleanly for another 
template engine, although I suspect it is.

I've never investigated it myself but I've heard that web2py's template 
engine works like this in any Python debugger.  I'm not 100% sure it's 
actually generating fake stack frames on its own but that is what it 
sounded like.  Seems like that's how any template engine should work, 
even if people are just looking at stack traces.

-- 

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com



More information about the wingide-users mailing list