No description
Find a file
Stefan Foulis 89b6463998 graceful handling of unset settings
Use blank defaults for MULTISITE_CMS_URLS, MULTISITE_CMS_ALIASES and 
MULTISITE_CMS_FALLBACK to minimise required configuration
2016-07-12 11:16:37 +02:00
djangocms_multisite graceful handling of unset settings 2016-07-12 11:16:37 +02:00
tests Initial import 2016-06-13 22:39:55 +02:00
.checkignore Initial import 2016-06-13 22:39:55 +02:00
.codeclimate.yml Initial import 2016-06-13 22:39:55 +02:00
.coveragerc Initial import 2016-06-13 22:39:55 +02:00
.editorconfig Initial import 2016-06-13 22:39:55 +02:00
.gitignore Initial import 2016-06-13 22:39:55 +02:00
.gitlab-ci.yml Initial import 2016-06-13 22:39:55 +02:00
.travis.yml Initial import 2016-06-13 22:39:55 +02:00
AUTHORS.rst Initial import 2016-06-13 22:39:55 +02:00
cms_helper.py Initial import 2016-06-13 22:39:55 +02:00
CONTRIBUTING.rst Initial import 2016-06-13 22:39:55 +02:00
HISTORY.rst Initial import 2016-06-13 22:39:55 +02:00
LICENSE Initial import 2016-06-13 22:39:55 +02:00
Makefile Initial import 2016-06-13 22:39:55 +02:00
MANIFEST.in Initial import 2016-06-13 22:39:55 +02:00
README.rst Fix documentation for installation 2016-07-04 08:43:22 +02:00
requirements-test.txt Initial import 2016-06-13 22:39:55 +02:00
requirements.txt Initial import 2016-06-13 22:39:55 +02:00
setup.cfg Initial import 2016-06-13 22:39:55 +02:00
setup.py Initial import 2016-06-13 22:39:55 +02:00
tox.ini Initial import 2016-06-13 22:39:55 +02:00

===================
djangocms-multisite
===================

.. image:: https://img.shields.io/pypi/v/djangocms-multisite.svg?style=flat-square
    :target: https://pypi.python.org/pypi/djangocms-multisite
    :alt: Latest PyPI version

.. image:: https://img.shields.io/pypi/dm/djangocms-multisite.svg?style=flat-square
    :target: https://pypi.python.org/pypi/djangocms-multisite
    :alt: Monthly downloads

.. image:: https://img.shields.io/pypi/pyversions/djangocms-multisite.svg?style=flat-square
    :target: https://pypi.python.org/pypi/djangocms-multisite
    :alt: Python versions

.. image:: https://img.shields.io/travis/nephila/djangocms-multisite.svg?style=flat-square
    :target: https://travis-ci.org/nephila/djangocms-multisite
    :alt: Latest Travis CI build status

.. image:: https://img.shields.io/coveralls/nephila/djangocms-multisite/master.svg?style=flat-square
    :target: https://coveralls.io/r/nephila/djangocms-multisite?branch=master
    :alt: Test coverage

.. image:: https://img.shields.io/codecov/c/github/nephila/djangocms-multisite/develop.svg?style=flat-square
    :target: https://codecov.io/github/nephila/djangocms-multisite
    :alt: Test coverage

.. image:: https://codeclimate.com/github/nephila/djangocms-multisite/badges/gpa.svg?style=flat-square
   :target: https://codeclimate.com/github/nephila/djangocms-multisite
   :alt: Code Climate

django-multisite support for django CMS

Supported Django versions:

* Django 1.6
* Django 1.7
* Django 1.8
* Django 1.9

Supported django CMS versions:

* django CMS 3.*

Usage
=====

#. Configure django-multisite as documented upstream

#. Use ``SITE_ID = SiteId(default=1)`` instead of the documented ``SITE_ID = SiteID()``


#. Add ``multisite``, ``djangocms_multisite`` to ``INSTALLED_APPS``::

    INSTALLED_APPS=[
        ...
        'multisite',
        'djangocms_multisite',
        ...
    ]

#. Add ``multisite.middleware.DynamicSiteMiddleware`` and ``djangocms_multisite.middleware.CMSMultiSiteMiddleware``
   to ``MIDDLEWARE_CLASSES``; ``multisite.middleware.DynamicSiteMiddleware`` must be applied before
   ``cms.middleware.utils.ApphookReloadMiddleware``, while ``djangocms_multisite.middleware.CMSMultiSiteMiddleware``
   must right after that::

    MIDDLEWARE_CLASSES = [
        ...
        'multisite.middleware.DynamicSiteMiddleware',
        'cms.middleware.utils.ApphookReloadMiddleware',
        'djangocms_multisite.middleware.CMSMultiSiteMiddleware',
        ...
    ]

#. Configure the URL mapping as follows::

    MULTISITE_CMS_URLS={
        'www.example.com': 'tests.test_utils.urls1',
        'www.example2.com': 'tests.test_utils.urls2',
    },
    MULTISITE_CMS_ALIASES={
        'www.example.com': ('alias1.example.com', 'alias2.example.com',),
        'www.example2.com': ('alias1.example2.com', 'alias2.example2.com',),
    },
    MULTISITE_CMS_FALLBACK='www.example.com'

#. Run ``python manage.py migrate``


Settings
========

MULTISITE_CMS_URLS
^^^^^^^^^^^^^^^^^^

Dictionary (or OrderedDict) containing the mapping between the domain (as configured in django
``sites``) and the corresponding urlconf.

MULTISITE_CMS_FALLBACK
^^^^^^^^^^^^^^^^^^^^^^

The default domain to load if any of the above does not match.

MULTISITE_CMS_ALIASES
^^^^^^^^^^^^^^^^^^^^^

Dictionary (or OrderedDict) containing the mapping between the domain (as configured in django
``sites``) and a list of aliases. This is optional if all the aliases are configured as
``django-multisite`` aliases