Merge pull request #10 from nephila/feature/use_get_host

Use higher level functions to discover current host
This commit is contained in:
Iacopo Spalletti 2016-07-04 08:59:43 +02:00 committed by GitHub
commit 35397dd4ff

View file

@ -10,11 +10,8 @@ from django.utils.six.moves import urllib_parse as urlparse
class CMSMultiSiteMiddleware(object):
def process_request(self, request):
try:
full_host = '{scheme}://{host}'.format(
scheme=request.scheme, host=request.META['HTTP_HOST']
)
parsed = urlparse.urlparse(full_host)
host = parsed.hostname
parsed = urlparse.urlparse(request.build_absolute_uri())
host = parsed.hostname.split(':')[0]
urlconf = None
try:
urlconf = settings.MULTISITE_CMS_URLS[host]