:-)

On Aug 8, 3:31 pm, Zhe Li <linuxcity...@gmail.com> wrote:
> Finally!! It works now! I switched my dev server to ubuntu 9.10 and
> everything works now! I couldn't find a repository for python2.5-
> psycopg2 in ubuntu 10.04 so I didn't try that.
>
> Regards,
> Zhe
>
> On Aug 8, 8:57 pm, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > Just now I found that it was using python2.5 and python2.5-psycopg2 in
> > the script, but in ubuntu 10.04 they have been removed from
> > repository. I will try to re-install it manually.
>
> > Cheers,
> > Zhe
>
> > On Aug 8, 8:27 pm, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > > Just an interesting note. Yesterday after the fresh re-installation, I
> > > tried to run "python web2py.py -a 0 -i 0.0.0.0" without psycog2, it
> > > gave me an "unable to connect to db" too, but didn't say that psycopg2
> > > is missing. Can it be the reason here? But I installed psycopg2 with
> > > apt-get it should set the path correctly.
>
> > > Cheers,
> > > Zhe
>
> > > On Aug 8, 8:18 pm, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I changed
>
> > > > local   all         web2py                            ident
>
> > > > to
>
> > > > local   all         all                            md5
>
> > > > in pg_hba.conf, but it still can't connect to it.
> > > > but i can connect to the database using:
>
> > > > sudo -u www-data psql -h localhost labdb -U web2py
>
> > > > Does that mean www-data has the permissions? By the way I was using
> > > > setup_web2py_ubuntu.sh so if it works on other machines, it should
> > > > work here too. Maybe I should try to set it manually following the
> > > > instructions in your book.
>
> > > > Cheers,
> > > > Zhe
>
> > > > On Aug 8, 7:31 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > aha! I think it is a problem with permissions of contect of databases
> > > > > folder. Make sure the apache/www-data user has permissions to read and
> > > > > write
>
> > > > > On Aug 8, 6:32 am, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > > > > > Hi Massimo,
>
> > > > > > Yes this time I was running it from a fresh installed ubuntu server 
> > > > > > so
> > > > > > PostgreSQL was using the default port.
>
> > > > > > I changed the pool_size to 0 and tried a couple of combinations. 
> > > > > > Maybe
> > > > > > it is a configuration problem with my PostgreSQL?
>
> > > > > > 1. If I run:
>
> > > > > > sudo -u www-data python www-data/web2py -a 0 -i 0.0.0.0
>
> > > > > > I will got an error of "ProgrammingError: relation 'auth_group'
> > > > > > already exists".
>
> > > > > > 2. visit the site runs on WSGI+apache gives me:
>
> > > > > > RuntimeError: Failure to connect to DB. Tried 5 times
>
> > > > > > 3. Launch site with the identical web2py code in my folder:
>
> > > > > > python web2py.py -a 0 -i 0.0.0.0
>
> > > > > > it runs without any problems.
>
> > > > > > Here is part of my pg_hba.conf:
>
> > > > > > local   all         postgres                          ident
> > > > > > # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
> > > > > > local   all         web2py                            ident
> > > > > > host    all         all         192.168.0.0/24        md5
> > > > > > host    all         all         127.0.0.1/32          md5
> > > > > > host    all         all         ::1/128               md5
>
> > > > > > and my postgresql.conf is:
>
> > > > > > listen_addresses = '*'          # what IP address(es) to listen on;
> > > > > > port = 5432                             # (change requires restart)
> > > > > > max_connections = 100                   # (change requires restart)
>
> > > > > > Thank you very much!
>
> > > > > > Regards,
> > > > > > Zhe
>
> > > > > > On Aug 8, 2:30 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > Didn't you say?
>
> > > > > > > db = DAL('postgres://web2py:12...@127.0.0.1:1216/labdb',
> > > > > > > pool_size=10)
>
> > > > > > > is the DB at port 1216 or 5432?
> > > > > > > Can you try with pool_size=0 just to isolate the problem.
>
> > > > > > > On Aug 7, 6:42 pm, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > > > > > > > Hi Massimo,
>
> > > > > > > > I am using PostgreSQL 8.4.
>
> > > > > > > > I added print(msg) and got the message when runnning python 
> > > > > > > > web2.py -a
> > > > > > > > 123, the string looks like
>
> > > > > > > > dbname='labdb' user='web2py' host='localhost' port=5432
> > > > > > > > password='test123'
>
> > > > > > > > I only have this error when using web2py with WSGI. But if I go 
> > > > > > > > to the
> > > > > > > > shell from the admin page running with WSGI, I could use 
> > > > > > > > PostgreSQL
> > > > > > > > without any problems. I tried this:
>
> > > > > > > > conn = psycopg2.connect("dbname='labdb' user='web2py' 
> > > > > > > > host='localhost'
> > > > > > > > port=5432 password='test123'")
>
> > > > > > > > and it works, I successfully added a table and a test record...
>
> > > > > > > > Thank you!
>
> > > > > > > > Cheers,
> > > > > > > > Zhe
>
> > > > > > > > On Aug 7, 5:30 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > > One more test:
>
> > > > > > > > > In gluon/sql.py
>
> > > > > > > > > before line 957, print your connection string:
> > > > > > > > >    print msg
> > > > > > > > > Would that connection string work on the shell? Which 
> > > > > > > > > postgresql
> > > > > > > > > version are you using?
>
> > > > > > > > > On Aug 6, 6:48 am, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > > > > > > > > > Yeah, that works fine. It's so odd and frustrating...
>
> > > > > > > > > > On Aug 6, 1:25 pm, mdipierro <mdipie...@cs.depaul.edu> 
> > > > > > > > > > wrote:
>
> > > > > > > > > > > I have no idea. Can you connect from a pure python shell 
> > > > > > > > > > > using the
> > > > > > > > > > > driver API?
>
> > > > > > > > > > > On Aug 6, 5:55 am, Zhe Li <linuxcity...@gmail.com> wrote:
>
> > > > > > > > > > > > thanks!
> > > > > > > > > > > > I tried to replace localhost with 127.0.0.1, 
> > > > > > > > > > > > 192.168.0.16 (it's
> > > > > > > > > > > > actually ip). but it doesn't work....
>
> > > > > > > > > > > > Cheers,
> > > > > > > > > > > > Zhe
>
> > > > > > > > > > > > On Aug 6, 12:33 pm, mdipierro <mdipie...@cs.depaul.edu> 
> > > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > Try replace
>
> > > > > > > > > > > > > localhost
> > > > > > > > > > > > > with
> > > > > > > > > > > > > 127.0.0.1
> > > > > > > > > > > > > and with the actual IP of the machine. It may not be 
> > > > > > > > > > > > > serving on
> > > > > > > > > > > > > localhost
>
> > > > > > > > > > > > > On Aug 6, 5:25 am, Zhe Li <linuxcity...@gmail.com> 
> > > > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > > Hi,
>
> > > > > > > > > > > > > > Thanks! This is the result from trunk.
>
> > > > > > > > > > > > > > Error traceback
> > > > > > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > > > > > >   File "gluon/restricted.py", line 186, in 
> > > > > > > > > > > > > > restricted
> > > > > > > > > > > > > >     exec ccode in environment
> > > > > > > > > > > > > >   File 
> > > > > > > > > > > > > > "/home/www-data/web2py/applications/welcome/models/db.py",
> > > > > > > > > > > > > >  line
> > > > > > > > > > > > > > 15, in <module>
> > > > > > > > > > > > > >     db = 
> > > > > > > > > > > > > > DAL('postgres://web2py:test...@localhost:1216/labdb')
> > > > > > > > > > > > > >        #
> > > > > > > > > > > > > > if not, use SQLite or other DB
> > > > > > > > > > > > > >   File "gluon/sql.py", line 3911, in DAL
> > > > > > > > > > > > > >     raise RuntimeError, "%s (tried 5 times)" % 
> > > > > > > > > > > > > > exception
> > > > > > > > > > > > > > RuntimeError: could not connect to server: 
> > > > > > > > > > > > > > Connection refused
> > > > > > > > > > > > > >     Is the server running on host "localhost" and 
> > > > > > > > > > > > > > accepting
> > > > > > > > > > > > > >     TCP/IP connections on port 1216?
> > > > > > > > > > > > > > could not connect to server: Connection refused
> > > > > > > > > > > > > >     Is the server running on host "localhost" and 
> > > > > > > > > > > > > > accepting
> > > > > > > > > > > > > >     TCP/IP connections on port 1216?
> > > > > > > > > > > > > >  (tried 5 times)
> > > > > > > > > > > > > > Error snapshot
> > > > > > > > > > > > > > Detailed traceback description
> > > > > > > > > > > > > > Exception: <type 'exceptions.RuntimeError'>(could 
> > > > > > > > > > > > > > not connect to
> > > > > > > > > > > > > > server: Connection refused Is the server running on 
> > > > > > > > > > > > > > host "localhost"
> > > > > > > > > > > > > > and accepting TCP/IP connections on port 1216? 
> > > > > > > > > > > > > > could not connect to
> > > > > > > > > > > > > > server: Connection refused Is the server running on 
> > > > > > > > > > > > > > host "localhost"
> > > > > > > > > > > > > > and accepting TCP/IP connections on port 1216? 
> > > > > > > > > > > > > > (tried 5 times))
> > > > > > > > > > > > > > Python 2.6.5: /usr/bin/python
>
> > > > > > > > > > > > > > This is odd since I can connect to it both from 
> > > > > > > > > > > > > > command-line and
> > > > > > > > > > > > > > another machine using web2py account....
>
> > > > > > > > > > > > > > Cheers,
> > > > > > > > > > > > > > Zhe
>
> > > > > > > > > > > > > > On Aug 6, 11:06 am, mdipierro 
> > > > > > > > > > > > > > <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > > > > > > > > Please check the version in trunk. It should give 
> > > > > > > > > > > > > > > you a more detailed
> > > > > > > > > > > > > > > error.
>
> > > > > > > > > > > > > > > On Aug 6, 3:06 am, Zhe Li 
> > > > > > > > > > > > > > > <linuxcity...@gmail.com> wrote:
>
> > > > > > > > > > > > > > > > Hello everyone,
>
> > > > > > > > > > > > > > > > I tried to deploy web2py on my ubuntu server 
> > > > > > > > > > > > > > > > using
> > > > > > > > > > > > > > > > setup_web2py_ubuntu.sh. Everything seemed fine 
> > > > > > > > > > > > > > > > except when I switch
> > > > > > > > > > > > > > > > database from SQLite to PostgreSQL I got:
>
> > > > > > > > > > > > > > > > Error traceback
> > > > > > > > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > > > > > > > >   File "gluon/restricted.py", line 178, in 
> > > > > > > > > > > > > > > > restricted
> > > > > > > > > > > > > > > >     exec ccode in environment
> > > > > > > > > > > > > > > >   File 
> > > > > > > > > > > > > > > > "/home/www-data/web2py/applications/init/models/db.py",
> > > > > > > > > > > > > > > >  line
> > > > > > > > > > > > > > > > 16, in <module>
> > > > > > > > > > > > > > > >     db = 
> > > > > > > > > > > > > > > > DAL('postgres://web2py:12...@127.0.0.1:1216/labdb',
> > > > > > > > > > > > > > > > pool_size=10)
> > > > > > > > > > > > > > > >   File "gluon/sql.py", line 3911, in DAL
> > > > > > > > > > > > > > > >     raise RuntimeError, "Failure to connect to 
> > > > > > > > > > > > > > > > DB.
>
> ...
>
> read more »

Reply via email to