I was too fast.
It works when accessed on port.

It doesn't when accessed through mod_wsgi:

File "gluon/sql.py", line 3835, in DAL
    migrate=migrate, fake_migrate=fake_migrate)
  File "gluon/sql.py", line 959, in __init__
    self._pool_connection(lambda : psycopg2.connect(msg))
  File "gluon/sql.py", line 830, in _pool_connection
    self._connection = f()
  File "gluon/sql.py", line 959, in <lambda>
    self._pool_connection(lambda : psycopg2.connect(msg))
NameError: global name 'psycopg2' is not defined

how are both environments different?
Julius




V Štvrtok, 27. máj 2010 o 12:20 +0200, Julius Minka napísal(a):
> I found the reason by removing exception catching when connecting to
> Postgres in gluon/sql.py.
> It told me that this line
>       self._execute("SET standard_conforming_strings=on;")
> is a problem.
> I commented it out and everything is fine until now.
> Can this removal have a side effect?
> Julius
> 
> 
> V Štvrtok, 27. máj 2010 o 10:41 +0200, Julius Minka napísal(a):
> > I did that as first thing. No luck.
> > I changed it to IP as I it works from command line.
> > 
> > Julius
> > 
> > V Streda, 26. máj 2010 o 19:41 -0500, Thadeus Burgess napísal(a):
> > > Try
> > > 
> > > postgres://w2p:passw...@localhost:5432/w2p
> > > 
> > > --
> > > Thadeus
> > > 
> > > 
> > > 
> > > 
> > > 
> > > On Wed, May 26, 2010 at 5:17 PM, Julius Minka <[email protected]> wrote:
> > > > This is virtual server with centos 5.5 in internet.
> > > > I have successfully instaled web2py with Apache and mod_wsgi based
> > > > mainly on instructions from
> > > > http://web2py.com/AlterEgo/default/show/239 and
> > > > http://web2py.com/AlterEgo/default/show/240
> > > >
> > > > Probably last step is missing.
> > > > I am getting this error when accessing site from internet:
> > > > RuntimeError: Failure to connect to DB. Tried 5 times
> > > >
> > > > when I start it from command line, it shows support for PostgreSQL:
> > > > python2.6 web2py/web2py.py -i xx.xx.xx.xx -p 7777 -a password
> > > >
> > > > web2py Enterprise Web Framework
> > > > Created by Massimo Di Pierro, Copyright 2007-2010
> > > > Version 1.78.3 (2010-05-17 21:59:39)
> > > > Database drivers available: PostgreSQL
> > > > Starting hardcron...
> > > > WARNING:root:GUI not available because Tk library is not installed
> > > > please visit:
> > > >        http://......
> > > >
> > > >
> > > > I can verify access from command line:
> > > > psql -U w2p -d w2p -h 127.0.0.1 -p 5432
> > > > Password for user w2p:
> > > > Welcome to psql 8.1.21, the PostgreSQL interactive terminal.
> > > >
> > > > Type:  \copyright for distribution terms
> > > >       \h for help with SQL commands
> > > >       \? for help with psql commands
> > > >       \g or terminate with semicolon to execute query
> > > >       \q to quit
> > > >
> > > > w2p=# \q
> > > >
> > > > It works.
> > > >
> > > >
> > > > In ... web2py/applications/welcome/models/db.py
> > > > db = DAL('postgres://w2p:[email protected]:5432/w2p')
> > > >
> > > > What could be the problem? I have no further idea how to verify the
> > > > reason for failure of connection.
> > > >
> > > > Julius
> > > >
> > > >
> > > >
> > 
> > 
> 
> 


Reply via email to