MongoEngine and dealing with “UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking”

和自甴很熟 提交于 2019-12-03 16:08:27

After searching a little bit online, i found out that it is possible to pass additional arguments to the mongoengine.connect function the additional arguments will be passed to the underlying PyMongo classes & functions.

So i simply edited the mongoengine.connect() call to the following:

mongoengine.connect('my_mongo_database_name', alias='default', connect=False)

And the warning stopped appearing. None the less i am not sure this is the best way to deal with the warning. If you have a better answer please post it and i will gladly test it and eventually accept it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!