Hi, I have an apache mod_wsgi app. I would like to source a script that exports a bunch of env variables before runs django wsgi, so django can use these vars. I know that I can set vars with setenv in httpd.conf but I wonder if I can save to set all variables sourcing a script. Thanks asked 22 Dec '16, 04:58 jorrete |
You can create a file like ~/.envs and put lines in the form of:
Then add a line to source the file at the start script, ~/webapps/<django_app>/apache2/bin/start, just before the httpd.worker one:
You should then be able to access those using calls like That said, the creator of mod_wsgi thinks this a bad idea and suggests using python configuration files instead. Such environement variables will also be visable in the output of a ps command (or similar), and although other users can't see your processes, it should still be taken into account. answered 22 Dec '16, 13:51 iliasr ♦♦ Thanks, I'll go with python conf.
(22 Dec '16, 13:52)
jorrete
|