﻿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
8896	Routing according also to hostname	veena	jshedd	"There should be a possibility to route urls even according to hostname.

It's quite often especially in blog sites that users get 3rd domain eg. http://username.example.com

In Django url router doesn't take hostname in consideration.

You can write own middleware, where you can rewrite username.example.com to something like example.com/user/username/ in process_request() function. But then function like ""reverse()"", decorator like ""login"" or template tag like ""{% url %}"" are not able to construct whole url with hostname back now.

In case of implementation routing with hostname there could be simple syntax in urls like that:

{{{
#!python
urlpatterns = (
  ('^forum/$', forum) # normal route
  ('^/(username)\.example\.com/forum/$', user_forum) # route with domain with http protocol
  ('^//(username)\.example\.com/forum/$', user_forum) # or syntax with double slashes to have a more impact to visibility and parallel to http://
  ('^s//(username)\.example\.com/forum/$', secure_user_forum) # route with domain with https protocol
)
}}}

There should be some enhancement to decouple hostname from route. For example:
{{{
#!python
  ('^//(username)\.SETTINGS_DOMAIN_WILDCARDS\.[a-zA-Z]{2-4}/forum/$', user_forum)
}}}

Or using some special mark:
{{{
#!python
  ('^//(?P<username>)(?site)/forum/$', user_forum) # complete with domain from actual Site or RequestSite object
  ('^//(?P<username>)(?site=2)/forum/$', user_forum) # complete with domain with ID 2 from Site object
}}}

In reverse functions proper url with hostname should be considered.

I think there is need to more clarify all possible circumstances they can occure before implementing of this feature would be start. It could be nice feature in 1.1 version of Django."	New feature	closed	Core (URLs)	1.0	Normal	wontfix	routing hostname	mike.huynh+django@… jedie Gert Van Gool Florian Apolloner cg@… charette.s@…	Someday/Maybe	0	0	0	0	0	0
