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’.
Add ‘multipledomain’ to ‘’INSTALLED_APPS’’:
INSTALLED_APPS += ( 'multipledomain', )
Add ‘multipledomain.middleware.MultipleDomainMiddleware’ to ‘’MIDDLEWARE_CLASSES’’:
MIDDLEWARE_CLASSES += ( 'multipledomain.middleware.MultipleDomainMiddleware', )
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'),
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-multiple-domains-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cc41ca52101d465aa1f3c17db5b32adae7c0a9f3b2b041c551ceb6907136fa1 |
|
MD5 | 0cac9eaed3fead97ab09ade5eef7977d |
|
BLAKE2b-256 | 82bffb2675c8ecf5c7810159aec0ea03170e5610f856c65029b670ab84afa55c |