djangosnippets.org: Latest snippets tagged with 'subdomain'http://djangosnippets.org/tags/subdomain/2010-06-11T07:55:53.491096-05:00django subdomain support for both resolve and reverse.
2010-06-11T07:55:53.491096-05:00puppyhttp://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 redistributableSubdomain Middleware
2008-10-09T06:59:26.150936-05:00xhenxhehttp://djangosnippets.org/snippets/1119/<p>This snippet will add the subdomain and domain to the request object for use in your views.</p>
Freely redistributable