This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description
Django Diazo
============

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

The code is maintained on GitHub (https://github.com/Goldmund-Wyldebeast-Wunderliebe/django-diazo).


Installation
------------

Install the package:

pip install django-diazo


### settings.py

Add the app to your project:

INSTALLED_APPS = (
...
'adminsortable2',
'django_diazo',
...
)

Add middleware (or WSGI, see below):

MIDDLEWARE_CLASSES += (
'django_diazo.middleware.DjangoDiazoMiddleware',
)

If you want to know if Django-Diazo is turned on in your templates add:

TEMPLATE_CONTEXT_PROCESSORS = (
...
'django_diazo.context_processors.diazo_enabled',
)

The variable `DIAZO_ENABLED` is now available in your templates.

!! IMPORTANT !!
Note that when using the Django middleware instrumentation the Diazo `<notheme />` rules won't work.
You have to provide regular expression patterns in `Theme.pattern` to prevent some pages (by url) to be themed.
When you want to disable theming for certain pages by content based rules for `<notheme />`, you need to use the
WSGI middleware instead.


### wsgi.py

If you rather use WSGI than Django middleware or you have to (at the moment) since you use exotic `<notheme />` rules,
add the following lines to your `wsgi.py` file:

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


### Database (migrations)

Add the following to your settings (Django >= 1.7):

MIGRATION_MODULES = {
'django_diazo': 'django_diazo.migrations_django',
}

Migrate the database:

python manage.py 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 `diazo.py` file in its root. The contents of
this file is should be something like this:

from django_diazo.theme import DiazoTheme, registry

class SomeTheme(DiazoTheme):
name = 'Some Theme'
slug = 'some_theme'
pattern = '^(?!.*admin)' # Theme everything but /admin
registry.register(SomeTheme)

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 manage.py syncthemes


DjangoCMS 3
------------

When using DjangoCMS 3, you might be interested in a toolbar switch to turn Diazo on/off.
Add the following to your settings:

INSTALLED_APPS = (
...
'django_diazo.contrib.cms',
...
)

MIDDLEWARE_CLASSES += (
...
'django_diazo.contrib.cms.middleware.DjangoCmsDiazoMiddleware',
)

The app will add the toolbar button, the middleware takes care of setting an on/off flag in the session.

Note that in production with wsgi middleware, this only works via a session (cookie), so not directly via the GET
parameter. You will have to reload the page after switching off the theme to get an unthemed site and vice versa.


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 `urls.py` (only works when `DEBUG = True`):

from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, 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.


Example themes / application
----------------------------

Take a look at https://github.com/Goldmund-Wyldebeast-Wunderliebe/django-diazo-themes and
https://github.com/Goldmund-Wyldebeast-Wunderliebe/django-diazo-blog for examples of built-in themes and an integration
example.

Our blog post http://www.goldmund-wyldebeast-wunderliebe.com/tech-blog/blog-posts/using-diazo-in-django also covers
these examples and some more background.

Also take a look at `django_diazo.contrib.themes` in this package.
Release History

Release History

2.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_diazo-2.0.2.zip (343.5 kB) Copy SHA256 Checksum SHA256 Source Jul 1, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting