Built-in support for Jinja2 in Django

336 views
Skip to first unread message

Aymeric Augustin

unread,
Oct 1, 2014, 3:04:37 PM10/1/14
to django-d...@googlegroups.com
Hello,

I’ve been thinking about providing built-in support for Jinja2 in Django. I found that supporting pluggable template engines, like Django does for databases, caches, etc. would be the most elegant solution. The best summary I have at this time is on the crowdfunding campaign’s page: http://igg.me/at/mtefd.

I will submit a detailed proposal to this mailing-list as soon as I have a sufficiently good version. Until then, if you hear noises, don’t worry — there will be a technical discussion here before any decision.

Thanks,

--
Aymeric.



Russell Keith-Magee

unread,
Oct 1, 2014, 7:28:01 PM10/1/14
to Django Developers
On Thu, Oct 2, 2014 at 3:04 AM, Aymeric Augustin <aymeric....@polytechnique.org> wrote:
Hello,

I've been thinking about providing built-in support for Jinja2 in Django. I found that supporting pluggable template engines, like Django does for databases, caches, etc. would be the most elegant solution. The best summary I have at this time is on the crowdfunding campaign's page: http://igg.me/at/mtefd.

I will submit a detailed proposal to this mailing-list as soon as I have a sufficiently good version. Until then, if you hear noises, don't worry -- there will be a technical discussion here before any decision.
 
SHUT UP AND TAKE MY MONEY!!!1!1!BBQ!
 
Seriously - thanks for taking this on. It's yet another of those huge projects with huge potential impact that you seem to excel in tackling. Can't wait to see the results!

Yours,
Russ Magee %-)

Gwildor Sok

unread,
Oct 2, 2014, 7:48:49 AM10/2/14
to django-d...@googlegroups.com
It's good to see something happening after the lengthy discussion of last February on this mailing list. Thank you for taking initiative in this. I believe this will be a great addition to make Django even better.

Bruno Ribeiro da Silva

unread,
Oct 2, 2014, 7:57:49 AM10/2/14
to django-d...@googlegroups.com

I think it's an awesome idea to have a pluggable template engine architecture in Django. I hope you can stretch the goal to have the second step (djando templates as a library) done too!

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ce7956c7-2ae6-4b95-aa1e-539cb81c3267%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josh Smeaton

unread,
Oct 2, 2014, 8:35:47 AM10/2/14
to django-d...@googlegroups.com
Nice! I've thought about trying to tackle this myself, but never got past the thinking stage. Thanks for taking this on Aymeric. I've got a couple of technical/design questions.

> I’ve been thinking about providing built-in support for Jinja2 in Django. I found that supporting pluggable template engines, like Django does for databases, caches, etc. would be the most elegant solution.

- The pluggable solution works well when you have a common interface, but a different implementation in the backend. Have you thought about how to support differences in syntax (interface) between various templating libraries?

- Do you imagine that jinja templates can be used side-by-side, or will authors have to ship a set of templates for each engine they decide to support?

Not sure that implementation questions are appropriate yet before you've started the DEP - so feel free to ask me to wait until then =)

Cheers,

Josh

Aymeric Augustin

unread,
Oct 2, 2014, 3:03:39 PM10/2/14
to django-d...@googlegroups.com
On 2 oct. 2014, at 14:35, Josh Smeaton <josh.s...@gmail.com> wrote:

> - The pluggable solution works well when you have a common interface, but a different implementation in the backend. Have you thought about how to support differences in syntax (interface) between various templating libraries?

Yes, I have. Preliminary research shows that all common templates engines except Django support variants of this pattern:
loader = TemplateLoader(**CONFIG)
template = loader.load(NAME)
html = template.render(**CONTEXT)
So I’m confident that it’s possible to provide a reasonable API that can be implemented with any decent template engine.

> - Do you imagine that jinja templates can be used side-by-side, or will authors have to ship a set of templates for each engine they decide to support?

One project will be able use different engines to render different templates. Authors of pluggable apps can ship any kind of template, however, they should describe which engines they require.

--
Aymeric.




Jesus Noland

unread,
Oct 3, 2014, 2:14:15 PM10/3/14
to django-d...@googlegroups.com
This is greatly needed. Thanks for taking this on.
Reply all
Reply to author
Forward
0 new messages