4đź‘Ť
I’ll be honest, I didn’t thoroughly read the responses. But I’m guessing it’s a lot of “no python in your templates” and “your view shouldn’t have much logic” type stuff.
If you put idealism aside and opt for pragmatism then I think Mako is a fine choice. I’m using it in a production capacity (mainly for speed, power and dynamic inheritance) for 3+ years now. It hasn’t failed or been otherwise annoying in any way.
The idealists are correct, but sometimes you have to go for what’s doable vs what’s right. If you are not limited by the Django templating engine use it. If you need more power, Mako and Jinja are fine choices.
Django makes it very easy to swap out templating engines and keep most things working as before:
http://docs.djangoproject.com/en/dev/ref/templates/api/#using-an-alternative-template-language
3đź‘Ť
Executing arbitrary code in templates should not be considered an inherently good thing. Taking advantage of such functionality is usually a sign that your architecture is broken.
That said, if you read the Django documentation, it explicitly says that you should feel free to use, discard, and replace any components you wish. Django is intentionally modular, and in fact, the two most trivially-replaceable components are the templating engine and the ORM.
If you want to use Mako instead of the Django templating engine, just use Mako.
- [Django]-How can i print unhandled exception to the Console instead of the Browser in Django?
- [Django]-Django Postgresql syncdb error
- [Django]-How do you access/configure summaries/snippets in Django Haystack
2đź‘Ť
The one reason I’d refrain from using jinja, Mako or anything else is that it may not make your app future proof with django enhancements.
There was a GSoc project proposal last year, by Alex Gaynor to make the template loading fast. – It was then retracted in favor of NoSQL project.
But with many more core developers and faster clearing of tickets, I’d stick to django full stack, knowing fully well, that components have to be changed to by home grown ones eventually.
If you are really looking for a glue framework on awesome python libraries, including the ones you choose, Flask is out there.
1đź‘Ť
addons.mozilla.org is using Django + Jinga: https://github.com/jbalogh/zamboni
Not sure whether or not the community frowns on Jinga, but many people like it, as an example.
- [Django]-Django Model API reverse lookup of many to many relationship through intermediary table
- [Django]-How do you render a django form in a view?
- [Django]-Json.parse gives Uncaught SyntaxError: Unexpected Token (Django json serialized queryset)
- [Django]-Django: Display contents of txt file on the website
0đź‘Ť
If you did mean “app”, rather than “project”, and it’s not for entirely private use, I would recommend that you not change the template engine; it will make the app much less likely to ever be used by anyone else as it’ll require them to alter some core settings, and it may break interaction between it and other apps or the project as a whole.
- [Django]-Django design patterns for overriding models
- [Django]-Django – How can I set/change the verbose name of Djangos User-Model attributes?
- [Django]-Django: Force cache-refresh after update
0đź‘Ť
Your example reminds me of the old PHP days when people would mix PHP with html all over the place. Felt really powerful. Until one day people realized that the mess is unmaintainable.
If the design is chopped up into “functions”, will a designer understand it then? It will probably annoy him.
- [Django]-Django cluster deployment
- [Django]-How to only sync custom permissions with syncdb?
- [Django]-Difficulty installing Django Debug Toolbar