This Django ticket says that they will not add a default Django template file extension. What file extension do you use?
html. djt). Without a differentiated extension, you need to open a file in order to know it's a django template and not a regular (e.g. HTML) file.
DjangoTemplates engines accept the following OPTIONS : 'autoescape' : a boolean that controls whether HTML autoescaping is enabled. It defaults to True . Only set it to False if you're rendering non-HTML templates!
Jinja is similar to the Django template engine but provides Python-like expressions while ensuring that the templates are evaluated in a sandbox. It is a text-based template language and thus can be used to generate any markup as well as source code. Jinja.
Django sets Jinja with two default behaviors, one for when DEBUG=True -- a common setting in development -- and the other for when DEBUG=False -- a common setting in production. If DEBUG=True and an invalid variable is set in a Jinja template, Jinja uses the jinja2.
I honestly believe we need a standard extension for django template files. A template is NOT valid CSS/HTML/XML or anything else.
Nick Presta wrote:
- You already know the files are templates because they should be in a template directory
- You don't want to have to open up files to see what they are (HTML, CSS, XML, etc). You would have to do this with a generic extension like .djt.
Point #2 can also be used in favor of a default extension or a mix (like .html.djt). Without a differentiated extension, you need to open a file in order to know it's a django template and not a regular (e.g. HTML) file.
And point #1 is just plain wrong, considering that they are not always in a template directory.
Ruby on Rails uses .html.erb
for erb templates, something similar will work for Django too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With