I can't get to work a fresh installation of web2py using postgresql 
database, it fails trying to connect to the database.

I have a new fresh installation of Ubuntu 14.04 + PostgreSQL 9.3.10 + 
Web2py 2.12.3
I've created the role "mytest" to login (in postgres), and I've created the 
database "mytest", owned by the user "mytest". Database is new, clean.
I've just edited the applications/welcome/models/db.py to initialize db 
like this:

db = DAL('postgres://mytest:mypassword@localhost/mytest', migrate=True, 
lazy_tables=False)

db.define_table('test', Field('field1'))


But when trying to access default/idex I have the following error:

Traceback (most recent call last):
  File "/home/gonguinguen/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/home/gonguinguen/web2py/applications/welcome/models/db.py" 
<http://localhost:8000/admin/default/edit/welcome/models/db.py>, line 18, in 
<module>
    db = DAL('postgres://%s:%s@%s/%s' % ('mytest', 'mytestpassword', 
'localhost', 'mytest'), migrate=True, lazy_tables=False)
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/base.py", line 174, 
in __call__
    obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/base.py", line 459, 
in __init__
    raise RuntimeError("Failure to connect, tried %d times:\n%s" % (attempts, 
tb))
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/base.py", line 437, 
in __init__
    self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 57, in __call__
    obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File 
"/home/gonguinguen/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
153, in __init__
    self.reconnect()
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/connection.py", line 
128, in reconnect
    self.after_connection_hook()
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/connection.py", line 
81, in after_connection_hook
    self.after_connection()
  File 
"/home/gonguinguen/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
157, in after_connection
    self.execute("SET CLIENT_ENCODING TO 'UTF8'")
  File 
"/home/gonguinguen/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
360, in execute
    return BaseAdapter.execute(self, *a, **b)
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 1378, in execute
    return self.log_execute(*a, **b)
  File "/home/gonguinguen/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 1372, in log_execute
    ret = self.cursor.execute(command, *a[1:], **b)
  File "/home/gonguinguen/web2py/gluon/contrib/pg8000/core.py", line 572, in 
execute
    self._c.execute(self, "begin transaction", None)
  File "/home/gonguinguen/web2py/gluon/contrib/pg8000/core.py", line 1697, in 
execute
    self.handle_messages(cursor)
  File "/home/gonguinguen/web2py/gluon/contrib/pg8000/core.py", line 1774, in 
handle_messages
    raise self.error
ProgrammingError: ('ERROR', '26000', 'prepared statement "pg8000_statement_0" 
does not exist')



I will appreciate any help on this

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to