[Answered ]-Subdomain Issue in Django

2👍

You shouldn’t alter your settings at runtime.

A better approach would be to set the request urlconf setting, as hinted in the section how django processes a request in the url docs.

if request.subdomain == 'foo':
    request.urlconf = 'bqsite.urls'
else:
    request.urlconf = 'dhsite.urls'

Leave a comment