Skip to main content

Django application, implement multi domain concept. You can choose your url config according to your domain host.

Installation

You can install the most recent Django Multi Domain version using pip:

pip install django-multidomain

Setup

NOTE: The following settings should be added to the project file ‘settings.py’.

  1. Add ‘multidomain’ to ‘’INSTALLED_APPS’’:

    INSTALLED_APPS += ( 'multidomain', )
  2. Add ‘multidomain.middleware.DomainMiddleware’ to ‘’MIDDLEWARE_CLASSES’’:

    MIDDLEWARE_CLASSES += ( 'multidomain.middleware.DomainMiddleware', )
  3. Create a file for each domain you have (For example: ‘domain-one.dev’ and ‘domain-two.dev’):

    * urls.py   (by default)
        from django.conf.urls import patterns, include, url
        from django.contrib import admin
        urlpatterns = patterns('',
            url(r'^admin/', include(admin.site.urls)),
        )
    
    * urls-one.py
        from django.conf.urls import patterns, include, url
        import one.urls
        urlpatterns = patterns(
            '',
            url(r'^', include(one.urls, namespace='one')),
        )
    
    * urls-two.py
        from django.conf.urls import patterns, include, url
        import two.urls
        urlpatterns = patterns(
            '',
            url(r'^', include(two.urls, namespace='one')),
        )
  4. Declare host/domain urlconfig tuple ‘’URL_CONFIG’’:

    URL_CONFIG = (
        (r'^(.+\.)?domain-one\.dev', 'urls-one'),
        (r'^(.+\.)?domain-two\.dev', 'urls-two'),
    )
    
    ROOT_URLCONF = 'urls'

Usage

It should create the following structure:

project_django/
| -- __init__.py
| -- settings.py
| -- wsgi.py
| -- urls-one.py
| -- urls-two.py
| -- urls.py        (default/optional)

NOTE: We use ‘’django-theming’’ library to manage multiple teming. (https://github.com/achavezu89/django-theming)

Contributing

Development of django-multidomain happens at github: https://github.com/cyacarinic/django-multidomain

Credits

Release files for django-multidomain 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-multidomain 1.1.4
File Size Uploaded
django-multidomain-1.1.4.tar.gz 2.5 kB Details

Release files / django-multidomain-1.1.4.tar.gz

Download URL django-multidomain-1.1.4.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9db056ebfbf436ff8d3bc7bb3992a2cfa7ed6ed0a4a91684b184193a6212b10e
BLAKE2b-256 checksum
How to use checksums
f28ccc3bd09ea9f65871d065e159071cc3231c2d5da546e62f53191d70098d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.4 This release

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page