Skip to main content

Django application, set urls per domain.

Project description

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


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

pip install django-multidomain


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

  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: ‘’ and ‘’):

    *   (by default)
        from django.conf.urls import patterns, include, url
        from django.contrib import admin
        urlpatterns = patterns('',
            url(r'^admin/', include(,
        from django.conf.urls import patterns, include, url
        import one.urls
        urlpatterns = patterns(
            url(r'^', include(one.urls, namespace='one')),
        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'


It should create the following structure:

| --
| --
| --
| --
| --
| --        (default/optional)

NOTE: We use ‘’django-theming’’ library to manage multiple teming. (


Development of django-multidomain happens at github:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-multidomain-1.1.4.tar.gz (2.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page