3. Themes support

It’s possible to enable different themes for different sites using ‘goscale.themes’ app.

It’s a combination of modified django-cms-themes and django-dynamicsites

Currently it’s possible to theme:

3.1. Installation

To use themes add ‘goscale.themes’ to INSTALLED_APPS:


Add ‘static’ context processor:


Add ‘SiteOnFlyDetectionMiddleware’ middleware before any other:


3.2. Usage

Create a new Theme in django admin and upload a theme tarball (tar.gz) file or put your theme files into ‘themes’ directory in your project and input the theme name.

Choose a Site to which this theme should apply.

After that you should have theme templates in your Page editing form.

For more information refer to django-cms-themes website.

3.3. Using theme files in templates

For theme static files:


For current theme name:


3.4. Theme switching on request

The beauty of goscale.themes app is that you can serve multiple themes and sites from the same django project instance. It’s enabled by SiteOnFlyDetectionMiddleware from django-dynamicsites.

You can switch themes dynamically by hosts in your browser.

For more information refer to django-dynamicsites documentation.

To enable multiple hosts for one theme (for example local, dev, staging servers) use SITE_ALIASES setting:

    'goscalecms.ru': 'goscalecms.com',

3.5. Debugging theme switching

The pattern for theme switching locally is:


So let’s say you’re running your server on localhost:8000. And you want to open theme goscale, then open: