Skip to main content

Manages to load templates according to the type of device to a specific directory prefix.

Project description

Manages to load templates according to the type of device to a specific directory prefix.

These loaders work with the django-mobi app. Please read the documentation for more information:


It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv.

From PyPi

pip install django-adaptive

From Github

-e git+


Before starting, make sure you have correctly setup django-mobi:

Django adaptive basicaly overwrites django default filesystem and app_directories loaders. You can pick the overwritten loader you want to use separately and use them concurently with the former django loaders.

The first step is to add the app in your installed apps list in


Then you will need to declare the loaders you want to add in your file


It’s also possible to use cached loader. It works with django 1.7.x

('django_adaptive.cached.Loader', (

Final step is to add ThreadLocal Middleware


Declaring your device prefixes

At this stage nothing will be done. You need to specify the directories for each device categories in your

The settings constants are:




Usage exemple:

import os

DEBUG = True

PROJECT_PATH = os.path.join(os.path.dirname(__file__), '..')

    os.path.join(PROJECT_PATH, 'templates')


This code will install the templates for mobile in the templates/mobile directory. And the rest of the files in templates (by default no prefix is added).

In case you would need to combine devices type in a similar directory, you just need to point them to it. For exemple:


This would render the same type of template for both tablets and mobile devices.

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-adaptive-1.0.2.tar.gz (4.9 kB view hashes)

Uploaded Source

Supported by

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