Go to file
Iacopo Spalletti ab3df90923 Merge pull request #18 from nephila/feature/reload_urlconf
Force reload at each request
2017-01-06 16:46:03 +01:00
djangocms_multisite Fix typo 2017-01-06 16:45:52 +01:00
tests Add -optional- djangocms-blog to test environment 2017-01-01 17:19:06 +01: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 Add django 1.10 / cms 3.4 2017-01-01 17:19:31 +01:00
AUTHORS.rst 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
MANIFEST.in Initial import 2016-06-13 22:39:55 +02:00
Makefile Initial import 2016-06-13 22:39:55 +02:00
README.rst typo 2016-07-20 17:54:42 +02:00
cms_helper.py Add -optional- djangocms-blog to test environment 2017-01-01 17:19:06 +01: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 Add django 1.10 / cms 3.4 2017-01-01 17:19:31 +01:00

README.rst

===================
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