Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!


A Django application that provides flexible template locations, allowing for
transparent alternate templates.

The template location can be set by middleware or request signals to modify
the template location for individual requests.


Install flext then modify your project's settings module so that the flext
template loader is first. For example::

    from django.conf.global_settings import TEMPLATE_LOADERS



A basic installation doesn't change how anything works in your project. To
actually use flext, you'll need to set (and unset) the flexible template
location by using middleware or request signals.

If you like reading code, view the source of the `included middleware`_ for an

The following functions can be used to alter the template directories which the
flexible template loader uses:

``django_flext.add_dirs(template_dirs, loader=None)``

Adds a list of template directories to use.

The file system template loader will be used unless an alternate loader is


Reset the flexible template loader so no template directories are used.

Included Middleware


This middleware adds one or more mobile-only template directories if the user
is visiting from a mobile domain.

Expects a ``MOBILE_TEMPLATE_DIRS`` setting which should be a tuple of
filesystem locations where the mobile template directories can be found.

To customise what is considered a mobile domain, set the optional
``MOBILE_DOMAIN_MATCH`` setting to a regular expression string (or object). By
default, any host name starting with "m." or "mobile." is considered a mobile

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.