gpt4 book ai didi

python - App Engine,pymongo.errors.ServerSelectionTimeoutError : connection closed, 连接已关闭,连接已关闭”

转载 作者:行者123 更新时间:2023-12-03 00:33:46 26 4
gpt4 key购买 nike

我使用的是 Python 3.7 和 Flask 1.0.2

I plugged my app to mongoDB Atlas, and all works fine in local

client = pymongo.MongoClient(connector)

connector是Atlas给我的标准连接字符串

connector = "mongodb://xxx:<PASSWORD>@xxcluster-shard-00-00-y0phk.gcp.mongodb.net:27017,xxcluster-shard-00-01-y0phk.gcp.mongodb.net:27017,xxxcluster-shard-00-02-y0phk.gcp.mongodb.net:27017/test?ssl=true&replicaSet=xxxCluster-shard-0&authSource=admin&retryWrites=true"

当我将应用程序部署到 Google App Engine 标准 Python3 运行时环境时,它不起作用。有人知道这个问题吗?

代码: enter image description hereAppengine 日志: enter image description here

本地日志(在本地工作正常): enter image description here

Appengine 错误:

pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed"

最佳答案

The problem was the Ip Whitelist, thus I have add via the vpc peering connection with gcp.

To do simple, we can add 0.0.0.0/0 to allow access from anywhere(but, be careful)

.

关于python - App Engine,pymongo.errors.ServerSelectionTimeoutError : connection closed, 连接已关闭,连接已关闭”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55005134/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com