简体   繁体   中英

uwsgi: os.getenv("PATH") does not work with /etc/environment in linux

I am serving a Flask app with uwsgi and nginx.

I noticed that within the uwsgi threads os.getenv("PATH") outputs:

/sbin:/usr/sbin:/bin:/usr/bin

Whereas my /etc/environment file is:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/dcm4che-3.3.8/bin"

I have rebooted my system post changing /etc/environment so I do not see a reason as to why os.getenv("PATH") is not including the information from /etc/environment.

Why is this happening?

upstart or systemd isn't sourcing /etc/environment . You can move the environment variables to /etc/default .

By sourcing /etc/environment in /etc/default/uwsgi you practically moved the environment variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM