Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
637 views
in Technique[技术] by (71.8m points)

pymongo - MongoClient opened before fork. Create MongoClient only Flask

I am running Flask with uwsgi threaded mode with processes 4 and using pymongo also flask_mongoengine and uwsgi says "MongoClient opened before fork. Create MongoClient only " I tried connect with connect=False but the result is same

lazy-apps = true problem is fixed but it seems that uwsgi needs more time to load what can be done for best performance ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

app.config['MONGODB_SETTINGS'] = {'DB': 'somedb', "USERNAME": "dbadmin", "PASSWORD":"somepass",'connect': False}

And

client = MongoClient(connect=False, username='dbadmin', password='somepass', authSource='somedb')

Solutions for Mongoengine and For pymongo


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...