What is the easiest way to obtain the user's host/domain name, if available? Or is there a function to lookup the IP address of the user to see if it is bound to a named address? (i.e. gethostbyaddr() in PHP)
HttpRequest.get_host() only returns the IP address of the user.
You can't rely on it, but you can try the
request.META['REMOTE_HOST']
orrequest.META['HTTP_HOST']
from theMETA
dictionary of therequest
:You can just print
HttpRequest.META
and find what you want and I thinkreq.META['HTTP_ORIGIN']
is the thing you need, It's the same as the browser address bar value.You can use
socket.gethostbyaddr()