【发布时间】:2019-03-28 18:35:56
【问题描述】:
我有一个在 Google 的 App Engine 上运行的应用程序,我希望它使用关联的 PostgreSQL 数据库。我正在使用 psycopg2 来帮助我进行 SQL 查询。但是我不确定如何设置连接。这是我目前拥有的:
con = psycopg2.connect(
host=HOST_NAME, # the IP address of the SQL database
database=DATABASE_NAME, # the name of the database (I'm using the default, so this is "postgres"
user=USER_NAME, # just the user name that I created
password=PASSWORD # the password associated to that user
)
但是,当我尝试发出请求时,我在创建此连接时收到错误 psycopg2.OperationalError: could not connect to server: Connection timed out。有什么我想念的吗?
【问题讨论】:
标签: python postgresql google-app-engine psycopg2