I used this string to connect to postgresql database
db = DAL( "postgres://mauricewaka:b123test##@localhost:5432/mydb")
as well as this
db = DAL( "postgres://mauricewaka:b123##@localhost/test")
But got this error:
Traceback (most recent call last):
File "/home/maurice/py4web/py4web/core.py", line 846, in import_app
module_name, init
File "<frozen importlib._bootstrap_external>", line 399, in
_check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "apps/letsdo/__init__.py", line 28, in <module>
db = DAL( "postgres://mauricewaka:b123test##@localhost/test")
File "/home/maurice/.local/lib/python3.6/site-packages/pydal/base.py", line
208, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
File "/home/maurice/.local/lib/python3.6/site-packages/pydal/base.py", line
525, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
File "/home/maurice/.local/lib/python3.6/site-packages/pydal/base.py", line
506, in __init__
self._adapter = adapter(**kwargs)
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/postgres.py",
line 28, in __call__
return AdapterMeta.__call__(cls, *args, **kwargs)
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/__init__.py",
line 41, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/postgres.py",
line 67, in __init__
after_connection,
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/base.py", line
417, in __init__
super(SQLAdapter, self).__init__(*args, **kwargs)
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/base.py", line
86, in __init__
self._initialize_()
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/postgres.py",
line 113, in _initialize_
self.get_connection()
File "/home/maurice/.local/lib/python3.6/site-packages/pydal/connection.py",
line 65, in get_connection
connection = self.connector()
File
"/home/maurice/.local/lib/python3.6/site-packages/pydal/adapters/postgres.py",
line 134, in connector
return self.driver.connect(**self.driver_args)
File "/home/maurice/.local/lib/python3.6/site-packages/psycopg2/__init__.py",
line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/2963aba0-7b00-44a8-a081-1c461f1cd1ac%40googlegroups.com.