skip to navigation
skip to content

Not Logged In

django_diazo 1.0

Integrate Diazo in Django using WSGI middleware and add/change themes using the Django Admin interface.

Latest Version: 1.1.1

Integrate Diazo in Django using WSGI middleware and add/change themes using the Django Admin interface.

The code is maintained on GitHub (


Install the package:

pip install django-diazo

Add the app to your project:


Add the following lines to your file:

# Apply WSGI middleware here.
from django_diazo.wsgi import DiazoMiddlewareWrapper
application = DiazoMiddlewareWrapper(application)

Database (South migrations)

Migrate the database:

python migrate django_diazo

Create a built-in theme

You might want to supply your Django application with an out-of-the-box theme, probably also managed in a VCS.

Create a new app with a file in its root. The contents of this file is should be something like this:

from django_diazo.theme import DiazoTheme, registry

class BootstrapTheme(DiazoTheme):
    name = 'Bootstrap Theme'
    slug = 'bootstrap_theme'

Don't forget to put your assets in the static folder, like an index.html and a rules.xml. You can find a rules.xml example in django_diazo/examples.

To synchronize the built-in themes with the database/application run the following command:

python syncthemes

Upload themes

By default, the .zip files that are uploaded are extracted in the media folder. You might want to serve these files via Django. Add the following to your

urlpatterns += patterns('',
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

For production environments it is not recommended to serve files from the media folder. This implementation only servers files in the themes folder within the media folder but it would be better to serve these files using a web server and not via Django. The same holds for your static folder.


If you want logging of the errors that might occur in the Diazo transformation, add the following to

DIAZO_LOG_FILE = '/var/log/django_diazo.log'

    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        'simple': {
            'format': '%(levelname)s %(message)s'
    'handlers': {
        'django_diazo_file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'formatter': 'verbose',
            'filename': DIAZO_LOG_FILE,
            'level': 'INFO',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
    'loggers': {
        'django_diazo': {
            'handlers': ['django_diazo_file', 'console'],
            'level': 'INFO',
            'propagate': True,

Example themes / application

Take a look at and for examples of built-in themes and an integration example.

Our blog post also covers these examples and some more background.

File Type Py Version Uploaded on Size (md5) Source 2013-12-20 327KB
  • Downloads (All Versions):
  • 22 downloads in the last day
  • 90 downloads in the last week
  • 578 downloads in the last month