Ask Your Question

Why does askbot use Jinja?

asked 2012-07-14 15:32:01 -0500

theactiveactor gravatar image

What is the reason that Askbot switched to the Jinja templating system? To my understanding, Jinja is based off the Django template system, but does not support template tags (without massive headache), which most third-party Django apps use. For example, I'm trying to integrate sorl-thumbnails, whose main API is a template tag ("thumbnail"), and I have to figure out a way to to manually render the tag first, before inflating the template. I already had to do this for my personal apps, which is highly annoying.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2012-07-14 19:15:22 -0500

Evgeny gravatar image

Jinja2 templates are a lot faster - that's mainly why. I've rewritten templates in Jinja2 and got at least 5x speedup of rendering.

It is a pain to integrate django template tags into Jinja2, I think it will be easier to rewrite some tags as Jinja2 macros.

edit flag offensive delete link more



Why did Instagram choose Jinja2 instead of Django Templates?

At the time, it was simply more flexible than the built-in tempting language (inline python). In our initial experience it was also much (much) faster. However, I believe in recent releases of Django they’ve addressed many of these differences, so I’m not sure we’d necessarily use Jinja2 from the start today. .. just found this link..

pcompassion gravatar imagepcompassion ( 2013-08-15 05:51:06 -0500 )edit

This is a pity. I'd happily trade a little bit of rendering speed if it makes askbot integratable. As it is now, askbot would force us to use jinja. We have a HUGE ecosystem of apps all using the django templating system. So it's not an option to switch. And we don't see a real speed benefit either, because template rendering is usually a tiny part of what takes time to render a request anyway. IMHO If askbot wants to be "integratable into existing django projects", it should switch to django templates.

stefanfoulis gravatar imagestefanfoulis ( 2014-04-23 01:29:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-07-14 15:32:01 -0500

Seen: 2,927 times

Last updated: Jul 14 '12