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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -