I'm using web2py with nginx, and I've experienced the following error
on redeploying my app:
socket.gethostbynamesocket.gethostbyname(http_host) File "/var/
web2py/cow/gluon/main.py", line 396, in wsgibase
socket.gethostbyname(http_host)]
gaierror: [Errno -2] Name or service not known
I traced this down to a particular section in gluon/main.py:
local_hosts = [http_host,'::1','127.0.0.1','::ffff:
127.0.0.1']
if not global_settings.web2py_runtime_gae:
local_hosts += [socket.gethostname(),
socket.gethostbyname(http_host)]
As it turns out, http_host (the value above) is mapped to the
nginx.conf value for http_host:
upstream custom_server_name {
server 127.0.0.1:8000;
}
It seems like what's happening is that web2py is receiving the http;//
custom_server_name instead of http://localhost, and
socket.gethostbyname() chokes on that. Is there something I should be
changing in the configuration to prevent this from happening?