Skip to main content

A Django Template Loader with priorities

Project description

Django TemplateLoaderWithPriorities

A django template loader that allows you to control the order which the template dirs (filesystem directories or apps’ template directories) are resolved in.

Useful when you want to override third party apps templates.

Installation and use

Get templateloaderwithpriorities from pypy or github:

$ pip install django-templateloaderwithpriorities

or:

$ pip install -e git+git://github.com/qubird/django-templateloaderwithpriorities#egg=templateloaderwithpriorities

Once installed, put the loader on top of settings.TEMPLATE_LOADERS:

TEMPLATE_LOADERS = ('templateloaderwithpriorities.Loader', ) + TEMPLATE_LOADERS

Be sure that it’s the first item of TEMPLATE_LOADERS, else your priorities will be ignored.

Then add TEMPLATE_LOADER_PRIORITIES to your settings.py:

TEMPLATE_LOADER_PRIORITIES = [
    'my.app',
    '/path/to/my/custom/templates'
]

The loader searches for templates in the given order, looking for the templates directory if the item is an app, or the directory itself if the item is an absolute path.

First come, first served.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-templateloaderwithpriorities-1.0dev.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file django-templateloaderwithpriorities-1.0dev.tar.gz.

File metadata

File hashes

Hashes for django-templateloaderwithpriorities-1.0dev.tar.gz
Algorithm Hash digest
SHA256 1beb09177df890dadd18245e80bc58e3a24f028f7442d21bcbe01bbe577e952e
MD5 d50de1b8893bb2718838d1949b409c3b
BLAKE2b-256 1107d6432ccfc44b47d249c22c5ae1234e90226e3c1405ef1382f6a344990ec9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page