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.txt
or equivalent:django-synth>=0.7.6
-
Enable it in your
settings.py
or 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:
list
ofstr
- 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:
False
when debugging,True
otherwise
What formats strings to use.
- Type:
dict
ofstr
- Defaults are taken (eponymously) from:
settings.TEMPLATE_STRING_IF_INVALID
settings.DATE_FORMAT
settings.DATETIME_FORMAT
settings.MONTH_DAY_FORMAT
settings.SHORT_DATE_FORMAT
settings.SHORT_DATETIME_FORMAT
settings.TIME_FORMAT
settings.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