django subdomain support for both resolve and reverse.
Add these two middleware to the top of MIDDLEWARE_CLASSES. Add BASE_DOMAIN to your setting file : BASE_DOMAIN = '.13.com'. your root urlconf may like this: urlpatterns = patterns('', url(r'^www:(?P<id>[0-9]+)/$', 'couponcn.store.views.site_index', name='site_index'), url(r'^news:abc/def/$', 'couponcn.store.views.site_index', name='site_index2'), ) then {% url site_index id=4 %}<br /> {% url site_index2 %} in your template or the reverse function will work out urls like this: http://www.13.com/4/ http://news.13.com/abc/def/
- url
- reverse
- resolve
- subdomain