How do I configure a Flask-based python app using nginx and uwsgi? -
i have flask-based python app needs bunch of configuration information (e.g. database connection parameters) on app start.
in nginx configuration, can provide parameters using uwsgi_param, shown in this question.
however problem request.environ
object not available outside of request handler, can't use @ application start. furthermore, i'm trying provide deployment-agnostic configuration mechanism can test using flask's embedded server during development , use parameters passed uwsgi in production.
what's best way configuration application it's accessible via os.environ
or similar?
look @ http://flask.pocoo.org/docs/config/#development-production. can have development, test , production config, can settings os envarment or specific file.
for example have config module , import secret settings (which don't want store source code) module. on deploy replace file secret settings. better use os envarement.
Comments
Post a Comment