Unobtrusive jinja2 integration in Django
Project description
© 2014 Thomas Khyn
Unobtrusive jinja2 integration in Django
Freely inspired from django-jinja and django-jinja2, as none of them met all my expectations!
Usage
Install djinga using the method of your choice
Add ‘djinga’ to your INSTALLED_APPS
Change the TEMPLATE_LOADERS settings to:
TEMPLATE_LOADERS = ( 'djinga.loaders.FileSystemLoader', 'djinga.loaders.AppLoader', )
Add the relevant settings for jinja2
How it works
By default, a template will be rendered using Django’s built-in template engine if it has a .html, .htm, .djhtml or .djhtm file extension. If it has a .jjhtml or .jjhtm file extension, it will be rendered by Jinja2, using the setting values provided in django’s setting module.
Settings
- JINJA2_DJ_EXTS
The file extensions for templates that should be rendered with Django’s internal template engine.
Defaults to ('html', 'htm', 'jjhtml', 'jjhtm')
- JINJA2_JJ_EXTS
The file extensions for templates that should be rendered with Jinja2.
Defaults to ('jjhtml', 'jjhtm')
- JINJA2_CONDITION
A function taking as sole argument the path of the template file and returning True if the file should be rendered with Jinja2. Defaults to a function returning True if the extension is in JINJA2_JJ_EXTS
- JINJA2_EXTENSIONS
The extensions to be loaded by jinja2. Some extensions are shipped with djinga under djinga.ext.*
- JINJA2_ENV_ARGS
The jinja2 environment’s constructor keyword arguments as a dictionary.
- JINJA2_GLOBALS
The jinja2 globals as a dictionary.
- JINJA2_FILTERS
The jinja2 filters as a dictionary.
Management command
Djinga overrides the Django core management command makemessages to include the specific Jinja2 translation tags and ensure the strings marked for translation in Jinja2 templates appear in the translations dictionary.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file djinga-1.1.zip
.
File metadata
- Download URL: djinga-1.1.zip
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ca650e7d16892e266effa64df1b8361ad2753cf61c697d427a0e1ad8dfbdb9 |
|
MD5 | b11842ce04691187164cfa97499c5dec |
|
BLAKE2b-256 | dbbb453b2a343f81ed81ffd5e96f2f4284a1b6b48fa6faa13b22e0efbdd6b7b4 |
File details
Details for the file djinga-1.1-py2.7.egg
.
File metadata
- Download URL: djinga-1.1-py2.7.egg
- Upload date:
- Size: 33.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26cf938e73118a38511fda4eff95e8cd2396376284beda29044f285303d7ef7b |
|
MD5 | 8b793f2cef5d3b0f2b2b4584d2ce3c7c |
|
BLAKE2b-256 | 8d62814e67d2cdf73ca2c0be7ed38f39c923b34dc9f8099b185a63e6a08c4961 |