Forums

Setting Environmental Variables

I've ran into a problem and was looking for some guidance. I'm following some principles outlined in Two Scoops of Django particularly around storage of sensitive keys and github. The idea is to keep sensitive keys in environmental variables and out of version control (duh right?). I have set the environmental variables in bash.rc. When I use a python command window I'm able to access the variables using os.environ['whatever']. The same code is throwing an error through my application. It works on my dev computer so I think the code is right and maybe I'm not doing something quite right with my PAW set up? Any ideas?

Your .bashrc is only run for consoles. It's a configuration file for bash, not web apps. To set environment variables for your web app, do it in your wsgi file using os.environ.