How to use Django to get the name for the host server?
I need the name of the hosting server instead of the client name?
Just add to @Tobu's answer. If you have a request object, and you would like to know the protocol (i.e. http / https), you can use request.scheme (as suggested by @RyneEverett's comment).
Alternatively, you can do (original answer below):
if request.is_secure():
protocol = 'https'
else:
protocol = 'http'
Because is_secure() returns True if request was made with HTTPS.