I wrote a patch to fix the problem on my server, which is basically just 
commenting out that line (main.py:390ish):

                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)]

It looks like that line is just to check for the request is coming from the 
externally facing IP. Could that perhaps be wrapped in a try-catch block 
and the results cached?

Thanks,
Chris


On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>
> I don't know if you have any constrain, but for testing purpose you can 
> use nginx setup script in web2py/scripts folder... There is one for ubuntu 
> at least...
>
> RicharD
>
> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>
>> 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?
>>
>
>
On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>
> I don't know if you have any constrain, but for testing purpose you can 
> use nginx setup script in web2py/scripts folder... There is one for ubuntu 
> at least...
>
> RicharD
>
> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>
>> 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?
>>
>
>
On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>
> I don't know if you have any constrain, but for testing purpose you can 
> use nginx setup script in web2py/scripts folder... There is one for ubuntu 
> at least...
>
> RicharD
>
> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>
>> 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?
>>
>
>

Reply via email to