More about Alcides Fonseca
Go Back

Template language for Django

Written by Alcides Fonseca at 2008/03/02

That’s true, I’m finally learning Django. Since I haven’t had no big website until now, I’ve been using my microwebframework pungi. But for large websites I feel the need for something more powerful and scalable.

I’ve been following (well, almost) the tutorial on the website adapting it to my needs. I’ve now reached the template part and I wondering if Django’s default template system is the best approach. I am pretty familiar with HTML and I even find it natural to write using XML tags, but I’m not sure if this is the best approach.

I’ve been looking for some alternatives (Yeah, Django is great because you can use whatever template language you want without any trouble!) and I found Brevé, a python DSL (or little language) for HTML generation. Writing Python is so much simple than the weird XML syntax. But I’m already used to HTML, so I got a problem here. And I believe there would be a more pythonic way of representing HTML. I feel ruby’s HTML generation in the CGI module (scroll down to “Print http header and html”) more readable than python lists. But okay that’s just my personal opinion.

I also took a look at PyMeld. Not quite a template language, but a way of manipulating HTML, that would have the same effect, but I believe Django’s template system is easier.

I could also use a client-side javascript template system, like MV suggests but I think neither me nor the world is ready for such thing.

So what would you choose if you were me?