How can I pass environment variables to a WSGI script, using uWSGI?
Posted
by
orokusaki
on Server Fault
See other posts from Server Fault
or by orokusaki
Published on 2012-12-19T23:09:52Z
Indexed on
2012/12/20
5:04 UTC
Read the original article
Hit count: 431
I've added the following line to /etc/environment
:
FOO_DEPLOYMENT_ENV="vbox"
Upon logging in via SSH, I can echo $FOO_DEPLOYMENT_ENV
and, of course, see vbox
output to the shell. If I open a Python shell and run os.getenv('FOO_DEPLOYMENT_ENV')
, it will return 'vbox'
, but the same code in my Python application, when run by uWSGI (as the www-data
user), it does not see the environment variable.
Clearly, this isn't a problem of uWSGI, and is rather a problem with my understanding of environment variables, or how they're properly set, and the contexts in which they can be retrieved. What am I doing or understanding incorrectly?
© Server Fault or respective owner