If you can connect from python It should work from web2py as well

'?!' - is this typo? ( in  postgres://test:xxxxx?!@...),  I mean that 
password goes from : to @  




On Sunday, June 16, 2019 at 10:49:27 PM UTC+3, Vlad wrote:
>
> I've got 50% of the answer. They require ssh tunnel to be used and don't 
> allow any direct connection. I understand that there is security reason for 
> that, yet I am at loss on how to handle this better. 
>
> Keeping ssh tunnel alive is problematic (for development it's fine, but 
> for production...) 
>
> So the only feasible solution for production environment to have 
> "internal" db, i.e. hosted in the same very web2py server environment 
> locally to avoid using tunnels. I mean, I am talking about cloud postgres 
> providers - I don't think it's practical for me to become a postgres expert 
> quickly and take care of its hosting by myself to allow a direct 
> connection. 
>
> Is this correct? 
>
> But regardless of tunnels, I have a problem with PythonAnywhere thing, 
> because there I use PA postgress and no tunnel required in such a 
> configuration. So, while this opens a valid connection: 
>
> import psycopg2
> connection = psycopg2.connect(database="test_db", user="test", password=
> "xxxxx", host="xxx-994.postgres.pythonanywhere-services.com", port=10994)
>
> web2py reports a connection error (i.e. when I specify db in appconfig 
> instead of opening a connection manually as above):
>
> psycopg2.OperationalError: FATAL: password authentication failed for user 
> "test"
>
> So exact same settings fail when in web2py ( postgres://test:xxxxx?!@
> xxx-994.postgres.pythonanywhere-services.com:10994/test_db )
>
> Greatly appreciate some pointers to the db direction. I am at loss on how 
> to handle this gracefully. SQLite has served perfect up until now, when I 
> have to get to a real db... 
>
>
>
>
> On Sunday, June 16, 2019 at 10:41:22 AM UTC-4, Vlad wrote:
>>
>> Okay, I recreated it in a simplest form, to get rid of any extra 
>> parameters. Can't make it working neither on windows nor on linux. Here is 
>> exactly what's going on: 
>>
>> *on linux: *
>>
>> the following code
>> import psycopg2
>> connection = psycopg2.connect(database="test_db", user="test", password=
>> "xxxxx", host="xxx-994.postgres.pythonanywhere-services.com", port=10994)
>> executes perfect. a valid connection is received. 
>>
>> However, when I specify exactly same in the appconfig 
>> ( postgres://test:xxxxx?!@
>> xxx-994.postgres.pythonanywhere-services.com:10994/test_db ) it fails 
>> with the following error:
>> psycopg2.OperationalError: FATAL: password authentication failed for user 
>> "test"
>>
>> The user and the password are correct though - besides creating a 
>> connection successfully by the code above, I've also verified in postgres 
>> itself, to make sure that the user was created successfully and that the 
>> permissions were given correctly. So it makes no sense that password 
>> authentication fails. 
>>
>> *and here is what I have on windows: *
>>
>> the code above doesn't even create a valid connection. Here is the error: 
>> "OperationalError(could not connect to server: Connection timed out 
>> (0x0000274C/10060) Is the server running on host "
>> xxx-994.postgres.pythonanywhere-services.com" (10.0.0.70) and accepting 
>> TCP/IP connections on port 10994? )"
>>
>> and when I specify the db in appconfig, it's a similar error (just coming 
>> from web2py wrapper, I guess): "psycopg2.OperationalError: could not 
>> connect to server: Connection timed out (0x0000274C/10060) Is the server 
>> running on host "xxx-994.postgres.pythonanywhere-services.com" 
>> (10.0.0.70) and accepting TCP/IP connections on port 10994?"
>>
>> *So psycopg2 at this point is present and found by Python *(not even 
>> sure what was the problem before, when it couldn't be found on windows), 
>> but *on windows connection fails, while on linux password authentication 
>> fails*.
>>
>> Greatly appreciate any ideas. 
>>
>>
>>
>> On Sunday, June 16, 2019 at 7:54:20 AM UTC-4, Vlad wrote:
>>>
>>> On this one I run web2py on Windows. Using web2py from source. No idea 
>>> what virtualenv is, so presumably not using it. Installed psycopg2 with 
>>> pip3 specifically, to make sure it goes into the right Python. (I am not 
>>> too familiar with this, but anything I install with pip goes to Python 2, 
>>> and pip3 puts everything under Python 3 which I use for web2py). And yes, 
>>> this is my development computer, so I restart web2py every time. 
>>>
>>> On Sun, Jun 16, 2019, 7:21 AM Val K <valq...@gmail.com <javascript:>> 
>>> wrote:
>>>
>>>> Did you restart web2py after installation? 
>>>>
>>>> -- 
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> --- 
>>>> You received this message because you are subscribed to a topic in the 
>>>> Google Groups "web2py-users" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/web2py/UINJvjQAyZk/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> web...@googlegroups.com <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/web2py/f86e442f-924a-4c97-b773-7865277006c4%40googlegroups.com
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7cb6e31e-ea4d-4a18-b656-664449ffeb3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to