I am implementing a Django deployment and have the following logic in my settings file.
if 'DEPLOYMENT_TYPE' in os.environ:
DEPLOYMENT = os.environ['DEPLOYMENT_TYPE'].upper()
Thus, I want to be able to set the ‘DEPLOYMENT_TYPE’ key in os.environ on a per-computer basis. I have tried in a separate shell:
os.putenv('DEPLOYMENT_TYPE', ...)
os.environ['DEPLOYMENT_TYPE'] = ...
However, these don’t work because I’m guessing os.environ gets populated when os is imported. Thus, what’s the best way to set the ‘DEPLOYMENT_TYPE’ on a per-computer basis? I can’t just stick the line in my settings file.
The whole point of
os.environis that it’s initialized from the shell environment it’s running in. So you should set it in the environment settings – iebash_profileor whatever – of the user that’s running the deployment.