4 ms·
If you haven't tried it yet, I highly recommend the Jinja2 template engine. It's almost a drop in replacement for Django templates, but has a proper if, macros
by andr 17y ago
If you haven't tried it yet, I highly recommend the Jinja2 template engine. It's almost a drop in replacement for Django templates, but has a proper if, macros and a few other extras. I have a Jinja version of render_to_response() and I will post it if someone is interested.
- diN0bot 17y agoplease do!
- samueladam 17y agoIf you are choosing the django stack, I would advise staying within the built-in template system. Jinja2 is a great project and I wish it was easy to integrate with django. I tried it through coffin http://github.com/dcramer/coffin http://github.com/dcramer/coffin and got hit by a few views from the contrib.auth models that had to be rewritten. If you want to plug django-apps, you will have to patch and maintain them to work with Jinja2. Coffin uses a nice trick to reload the view functions code with a Jinja2 version of render_to_response and RequestContext: http://github.com/dcramer/coffin/blob/master/coffin/contrib/auth/views.py http://github.com/dcramer/coffin/blob/master/coffin/contrib/... Note that django 1.2 will include 'Smart' if tags and Template caching if that is what you are looking for in Jinja2: http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#smart-if-tag http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#s...
- nek4life 17y agoIn the 1.2 release notes it states that due to changes made to the template caching layer it is now much easier to work with non-django template languages. http://docs.djangoproject.com/en/dev/releases/1.2/#template-caching http://docs.djangoproject.com/en/dev/releases/1.2/#template-...
- samueladam 17y agoI hope so, but I realized I chose django because it comes with batteries included. If you're after Jinja2, wouldn't you find it more interesting to work with a minimalistic stack like Werkzeug, SqlAlchemy, couchdbkit... ?