﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
5022	Proposed middleware: SubdomainURLsMiddleware	tzellman@…	nobody	"I'm developing an application and want to support subdomains. What I had in mind was the ability to support different views depending on the subdomain hit. Essentially, what it comes down to is I want the ability to support separate URL configurations (and thus views) for certain subdomains (known ahead of time). For example, I may have a mobile.mysite.com, where the 'mobile' subdomain deals with urls/views meant for mobile phones.

I noticed issue #4438, and it wasn't exactly what I wanted, or the right solution, so I started researching.

I noticed that in BaseHandler::get_response it attempts to get the 'urlconf' attribute from the request. So, I created a middleware that figures out the subdomain (some code borrowed from http://www.rossp.org/blog/2007/apr/28/using-subdomains-django/), and matches it against a subdomain->urlconf dictionary in settings.py. And voila! It works! Attached is the file that with the proposed solution.

I am open for critiques/discussion of this topic.

Thanks,
Tom Zellman"	Uncategorized	closed	Uncategorized	dev	Normal	wontfix	enhancement proposal subdomain domain urlconf	drackett@…	Design decision needed	1	0	0	0	0	0
