I am using the django-subdomains package to create subdomains. The problem is that no matter how I configure SUBDOMAIN_URLCONFS, the site always routes everything that I put in ROOT_URLCONF by default. Any understanding of what I am doing wrong will be greatly appreciated!
EDIT: Added MIDDLEWARE_CLASSES
MySite / settings.py
... MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'subdomains.middleware.SubdomainURLRoutingMiddleware', ) ... ROOT_URLCONF = 'mysite.urls' SUBDOMAIN_URLCONFS = { None: 'mysite.urls', 'www': 'mysite.urls', 'myapp': 'myapptwo.test', } ...
MySite / urls.py
from django.conf.urls import patterns, include, url from myapp import views from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^admin/', include(admin.site.urls)), )
Myapp / views.py
from django.shortcuts import render from django.http import HttpResponse def index(Request): return HttpResponse("Hello world.")
myapptwo / urls.py
from django.conf.urls import patterns, include, url from myapptwo import views from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^admin/', include(admin.site.urls)), )
myapptwo / views.py
from django.shortcuts import render from django.http import HttpResponse def index(Request): return HttpResponse("Hello world. This is the myapptwo subdomain!")