Fixed context_processor

This commit is contained in:
Amazed 2018-11-30 22:02:41 +01:00
parent a7bbd79cf3
commit e2028bbe48
1 changed files with 4 additions and 3 deletions

View File

@ -7,9 +7,10 @@ def BASE_URL(request):
else:
scheme = 'http://'
fullhost = request.get_host()
port = fullhost.split(":")[1]
host = fullhost.split(":")[0]
port = request.get_port()
if port == 80 or port == 443:
base = fullhost.split(":")[0]
base = host
else:
base = fullhost
base = host+":"+port
return {'BASE_URL': scheme + base, }