djangosnippets.org: Latest snippets posted by puppyhttps://djangosnippets.org/users/puppy/2010-06-11T07:55:53.491096-05:00puppydjango subdomain support for both resolve and reverse.
2010-06-11T07:55:53.491096-05:00puppyhttps://djangosnippets.org/snippets/2062/<p>Add these two middleware to the top of MIDDLEWARE_CLASSES.
Add BASE_DOMAIN to your setting file : BASE_DOMAIN = '.13.com'.</p>
<p>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'),
)</p>
<p>then
{% url site_index id=4 %}<br />
{% url site_index2 %}</p>
<p>in your template or …</p>
Freely redistributable