(psycopg2.operational error)致命:用户“postgres”的密码身份验证失败

2024-05-19 03:41:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我在googleappengine上部署了一个简单的应用程序,它捕捉ip地址、时间戳、纬度和经度,参考本教程-gt;https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql-postgres

我按照教程中的说明做了,并且能够在我的机器上本地运行python main.py。下面是结果(实际结果显示经度和纬度的值。例如)

Last 10 visits:
Time: 2017-03-13 07:19:13.330896 Addr: 127.0 Latitude: <some value> Longitude <some value>
Time: 2017-03-13 07:19:06.486184 Addr: 127.0 Latitude: <some value> Longitude <some value>

它将这些数据保存到我之前使用python create_tables.py创建的数据库中,如教程中所述。在

然后我在googleappengine上部署了这个应用,但是有一个错误说

^{pr2}$

当我访问链接https://<project_id>.appspot.com(注意,实际的链接确实有项目id,这只是示例)

[附加信息]

在教程中,有一节介绍如何设置本地环境来测试应用程序。我喜欢本教程中的内容,在我的本地环境中安装cloudsql代理的副本,结果如下。在

Fang-Air:~ Fang$ ./cloud_sql_proxy -dir=/cloudsql &
[1] 81439
Fang-Air:~ Fang$ 2017/03/13 15:44:33 Using gcloud's active project: <project_id>
2017/03/13 15:44:43 Error listing instances in <project_id>: Get https://www.googleapis.com/sql/v1beta4/projects/<project_id>/instances?alt=json: Post https://accounts.google.com/o/oauth2/token: net/http: TLS handshake timeout
2017/03/13 15:44:43 no Cloud SQL Instances found in these projects: [<project_id>] 

我重新检查了我的项目,其中有一个实例包含postgres数据库,但在这个结果中,它显示没有找到云sql实例。在

我想知道这是否与我在部署应用程序后遇到的问题有关,但据我在本教程中了解,这只是针对本地环境。在

关于我的问题,我想知道是否有人对如何解决这个错误提出建议或方法。在

我的操作系统和Postgresql版本是

OS X El Capitan 10.11.6
psycopg2 2.6.2

谢谢你的帮助


Tags: httpsprojectcomid应用程序cloudsql环境

热门问题