postgresql could not connect解决方法
$python>>> from sqlalchemy import *
>>> s= "postgres://root:root@localhost:5432/testing"
>>> engine = create_engine( s )
>>> c = engine.connect()
......
sqlalchemy.exceptions.DBAPIError: (Connection failed) (OperationalError) could not connect to server: No route to host
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
1.
$vi /etc/postgresql/7.4/main/postgresql.conf
修改如下:
#tcpip_socket = false
tcpip_socket = true
2.
$ apt-get install python-psycopg2
或则
& apt-get install python-psycopg
结果如下:
>>> c = engine.connect()
>>>
页:
[1]