All Projects → nephila → djangocms-multisite

nephila / djangocms-multisite

Licence: BSD-3-Clause License
django-multisite support for DjangoCMS

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to djangocms-multisite

jw-wpcli-random-posts
A robust random post generator for WP CLI which supports multisite, post types, post counts, taxonomies, terms, term counts and featured images. Complete with a cleanup command to undo it all!
Stars: ✭ 58 (+132%)
Mutual labels:  multisite
bea-plugin-defaults
Library of WordPress mu-plugins to set plugin's default options.
Stars: ✭ 17 (-32%)
Mutual labels:  multisite
Multisite-Language-Switcher
WordPress Plugin: Multisite Language Switcher
Stars: ✭ 118 (+372%)
Mutual labels:  multisite
Multisites
Multisites on a single Zikula instance
Stars: ✭ 11 (-56%)
Mutual labels:  multisite
wp-site-cloner
Create sites with content from other sites
Stars: ✭ 22 (-12%)
Mutual labels:  multisite
ENIGMA
The ENIGMA Toolbox is an open-source repository for accessing 100+ ENIGMA statistical maps, visualizing cortical and subcortical surface data, and relating neuroimaging findings to micro- and macroscale brain organization. 🤠
Stars: ✭ 66 (+164%)
Mutual labels:  multisite
bea-content-sync-fusion
Synchronize contents across your Multisite.
Stars: ✭ 41 (+64%)
Mutual labels:  multisite
PyLucid
PyLucid is ready to use Django-CMS setup
Stars: ✭ 72 (+188%)
Mutual labels:  djangocms
Appactive
AppActive: A middleware to build an application with multiple active architectures(阿里巴巴开源的一款标准通用且功能强大的构建应用多活架构的开源中间件)
Stars: ✭ 241 (+864%)
Mutual labels:  multisite
wp-blog-meta
A global, joinable meta-data table for your WordPress Multisite sites
Stars: ✭ 25 (+0%)
Mutual labels:  multisite
TriTan-CMS
TriTan CMS is a developer centric content management framework that allows you to go completely headless or nearly headless. With the mighty TriTan, you can build amazing RESTful applications and robust websites.
Stars: ✭ 19 (-24%)
Mutual labels:  multisite

djangocms-multisite

django-multisite support for DjangoCMS

Join the Gitter chat Latest PyPI version Python versions Latest Travis CI build status Test coverage Test coverage Code Climate License

Support

Supported Django versions:

  • Django 3.0
  • Django 2.2

Supported django CMS versions:

  • django CMS 3.7

Assumptions

  1. A virtualenv up and running
  2. DjangoCMS working

Installation

pip install djangocms-multisite

Usage

  1. Open your settings.py file

  2. We need to add the configurations for django-multisite :

    • Replace SITE_ID value with the SiteID function:

      from multisite import SiteID
      SITE_ID = SiteID(default=1)
      
    • Add multisite, djangocms_multisite to INSTALLED_APPS:

      INSTALLED_APPS=[
          ...
          'multisite',
          'djangocms_multisite',
          ...
      ]
      
    • Add those loders in the TEMPLATES setting:

      TEMPLATES = [
          ...
          {
              ...
              'DIRS': {...}
              'OPTIONS': {
                  'loaders': (
                      'multisite.template.loaders.filesystem.Loader',
                      'django.template.loaders.app_directories.Loader',
                  )
              }
              ...
          }
          ...
      ]
      
    • For other settings (cache, etc.) check the django-multisite page

  3. Add multisite.middleware.DynamicSiteMiddleware and djangocms_multisite.middleware.CMSMultiSiteMiddleware to MIDDLEWARE_CLASSES. The order is important: multisite.middleware.DynamicSiteMiddleware must be applied before cms.middleware.utils.ApphookReloadMiddleware, while djangocms_multisite.middleware.CMSMultiSiteMiddleware must be right after:

    MIDDLEWARE_CLASSES = [
        ...
        'multisite.middleware.DynamicSiteMiddleware',
        'cms.middleware.utils.ApphookReloadMiddleware',
        'djangocms_multisite.middleware.CMSMultiSiteMiddleware',
        ...
    ]
    
  4. Configure the URL mapping as follows. The tests.test_utils.urls1 path can be the main urlconf file that you already have in your project. And it can be the same for all the domains if you need the same structure.:

    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'
    
  5. Run python manage.py makemigrations

  6. Run python manage.py migrate to apply the django-multisite migrations

Settings explanation

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

Troubleshooting

  • Domains in MULTISITE_CMS_URLS must be the same created in your database (via the interface in Home › Sites › Sites).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].