Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Django middleware for serving single Django instance in multiple domains with different urls.

Project Description

Django middleware for serving single Django instance in multiple domains with different urls.

Installation

ost recent Django Multiple Domain version using pip:

pip install django-multiple-domains

Setup

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

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

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

    MIDDLEWARE_CLASSES += ( 'multipledomain.middleware.MultipleDomainMiddleware', )
    
  3. Create different urls config file for each domain (Ex: ‘site.com’ and ‘blog.com’):

    * urls_site.py   (by default)
        url(r'^$', TemplateView.as_view(template_name='site.html'), name='site'),
    
    * urls_blog.py
        url(r'^$', TemplateView.as_view(template_name='blog.html'), name='blog'),
    
  4. Declare host/domain urlconfig tuple ‘’MULTIURL_CONFIG’‘:

    MULTIURL_CONFIG = {
        'site.com': 'urls_site',
        'blog.com': 'urls_blog',
    }
    
    ROOT_URLCONF = 'urls_site'
    

Related urls: https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.get_host

Release History

This version
History Node

0.0.1

Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
django-multiple-domains-0.0.1.tar.gz
(2.1 kB) Copy SHA256 Hash SHA256
Source None Oct 7, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting