hi, i wanted to know in python how can i get the host the user came from? how do i extract it?
i tried this:
host = self.request._environ['HTTP_HOST']
but it's empty...
Do you have any idea what it should be
Thanks.
hi, i wanted to know in python how can i get the host the user came from? how do i extract it?
i tried this:
host = self.request._environ['HTTP_HOST']
but it's empty...
Do you have any idea what it should be
Thanks.
self.request._environ['HTTP_HOST']
tells you your host name.
You can use self.request.remote_addr
to get the remote IP address. You'll need to do a reverse DNS lookup (which might fail) if you need a host name from that.