A bridge between Django and Synth that enables fast, efficient parsing and rendering of templates natively. The goal of django-synth is to have achieve compatibility with Django's original template system, including support for custom libraries, tags and filters.
pip install pip --upgrade # Ensure pip has wheel support
pip install django-synth --upgrade # Get the latest and greatest
-
Add it to your
requirements.txtor equivalent:django-synth>=0.7.6 -
Enable it in your
settings.pyor equivalent:TEMPLATE_LOADERS = ( 'django_synth.loaders.FilesystemLoader', 'django_synth.loaders.AppDirectoriesLoader', )
Which template syntax to use: "django", "ssi" or "tmpl".
- Type:
str - Default:
"django"
Where to look for templates.
- Type:
listofstr - Default:
settings.TEMPLATE_DIRS
Whether to enable debugging (slower but more informative.)
- Type:
bool - Default:
settings.TEMPLATE_DEBUG
Whether to enable caching.
- Type:
bool - Default:
Falsewhen debugging,Trueotherwise
What formats strings to use.
- Type:
dictofstr - Defaults are taken (eponymously) from:
settings.TEMPLATE_STRING_IF_INVALIDsettings.DATE_FORMATsettings.DATETIME_FORMATsettings.MONTH_DAY_FORMATsettings.SHORT_DATE_FORMATsettings.SHORT_DATETIME_FORMATsettings.TIME_FORMATsettings.YEAR_MONTH_FORMAT
- ReadTheDocs-compatible documentation
- Docstrings for all public types and functions
- Use paths for top-level templates (in the loaders) rather than string sources, to avoid copying and enable caching
- Make test suite unittest-compatible and add to setup
- Example project
