0

ENVIRONMENT_CONFIG_FILE contains :

MONGODB_SETTINGS = {
    'host': 'localhost',
    'port': 27017,
    'db': 'my_db'
}

//in my application
app.config.from_envvar('ENVIRONMENT_CONFIG_FILE_LOCATION')

MongoEngine(app)

supposed I want to set read_prefrences, I can do it in the application level

from pymongo import ReadPreference
app.config['MONGODB_SETTINGS']['read_prefrences'] = ReadPreference.PRIMARY
MongoEngine(app)

which will work, but I want to set the read_preferences in the config file. how do I do that since ReadPreference.PRIMARY is not a string?

WebQube
  • 8,510
  • 12
  • 51
  • 93

0 Answers0