#8896: Routing according also to hostname
------------------------------+---------------------------------------------
 Reporter:  veena             |       Owner:  nobody    
   Status:  new               |   Milestone:  post-1.0  
Component:  Core framework    |     Version:  1.0       
 Keywords:  routing hostname  |       Stage:  Unreviewed
Has_patch:  0                 |  
------------------------------+---------------------------------------------
 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.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8896>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to