pymongo-3.x

Why is PyMongo 3 giving ServerSelectionTimeoutError?

时间秒杀一切 提交于 2019-11-27 11:54:59
I'm using: Python 3.4.2 PyMongo 3.0.2 mongolab running mongod 2.6.9 uWSGI 2.0.10 CherryPy 3.7.0 nginx 1.6.2 uWSGI start params: --socket 127.0.0.1:8081 --daemonize --enable-threads --threads 2 --processes 2 I setup my MongoClient ONE time: self.mongo_client = MongoClient('mongodb://user:pw@host.mongolab.com:port/mydb') self.db = self.mongo_client['mydb'] I try and save a JSON dict to MongoDB: result = self.db.jobs.insert_one(job_dict) It works via a unit test that executes the same code path to mongodb. However when I execute via CherryPy and uWSGI using an HTTP POST, I get this: pymongo

Why is PyMongo 3 giving ServerSelectionTimeoutError?

社会主义新天地 提交于 2019-11-27 03:59:06
问题 I'm using: Python 3.4.2 PyMongo 3.0.2 mongolab running mongod 2.6.9 uWSGI 2.0.10 CherryPy 3.7.0 nginx 1.6.2 uWSGI start params: --socket 127.0.0.1:8081 --daemonize --enable-threads --threads 2 --processes 2 I setup my MongoClient ONE time: self.mongo_client = MongoClient('mongodb://user:pw@host.mongolab.com:port/mydb') self.db = self.mongo_client['mydb'] I try and save a JSON dict to MongoDB: result = self.db.jobs.insert_one(job_dict) It works via a unit test that executes the same code path