5👍
Jinja2 is very much like Django templates: http://splike.com/wiki/Convert_Django_Templates_to_Jinja2
Mako is very much NOT like Django.
Try these two and see what approach you like best.
3👍
Maybe jinja2: http://lethain.com/replacing-django-s-template-language-with-jinja2/
Why do you want to replace it? It is very powerful and has so much built in support. I would think you would want to replace it if you already had a specific template system in mind.
- [Django]-Keep User and Group in same section in Django admin panel
- [Django]-Django – WSGI script cannot be loaded as Python module
- [Django]-How to use pip in virtualenv
- [Django]-Can I have 2 Django sites using 2 different version of Python on 1 domain?
1👍
Jinja2 is the most popular replacement I know of. The biggest difference is that it allows you to put significantly more logic and code into your templates: Django’s templating system is deliberately restrictive in this regard.
I have used Jinja2 and have to say I personally prefer Django’s template system, simply because it encourages a cleaner style where as much processing as possible is done in the view code, making refactoring and testing easier.
As for performance, there is a section in the Jinja2 FAQ which claims Jinja2 and Mako are roughly equivalent, and both about 20 times faster than Django’s template renderer, but also points out that such benchmarks are all but meaningless.
- [Django]-How to set cookie for many views?
- [Django]-Allow only one concurrent login per user in django app
- [Django]-How is python manage.py createsuperuser useful?
1👍
Coffin project contributors are trying to build a complete drop-in replacement for Django Template. Coffin api loads Django Filters and tags for you, so you can enjoy Jinja templating and use existing Filtes and Tag Libs written for Django.
Coffin project is actively maintained. You can read more reference here:
- justcramer.com/2009/09/14/using-jinja2-with-django/
- matthowell.com/blog/2011/03/02/integrating-jinja2-and-django/
- [Django]-How make conditional expression on Django with default value of object?
- [Django]-Django: need help with keeping apps from depending on one another
0👍
I don’t use templates at all, preferring a pure python OO approach.
To be able to do this I code a small but useful library in Python, that let me generates any mark-up code.
I could say that the experience is somehow similar to the one you can have with a tool such as QT… obviously, my tool is way smaller than a vast tool like QT, there are some similarities, especially in the use of classes and the Composite pattern.
I think many people will dislike my approach. However, if you want to take a look, here is the link to the code:
- [Django]-Form loses ability to send POST requests after 2 ajax updates
- [Django]-Forcing Django to use INNER JOIN instead of LEFT OUTER JOIN
- [Django]-Search multiple fields of django model without 3rd party app
- [Django]-How can I limit http method to a Django REST api
0👍
https://pypi.org/project/yawrap/
Templateles, pure pythonic html generator. It’s fast, has no dependencies, runs on python 2.7, 3.x and pypy.
Outputs ideally indented html code with zero overhead (indents for free).
No need to use tags or filters from django, because you already have absolutelly everything in python.
- [Django]-Django not working with supervisor, getting [Errno 88] Socket operation on non-socket
- [Django]-Add expire time for validation and verification in Djoser