David542
David542

Reputation: 110462

wsgi.py to replace source variables

How would I do the following in my wsgi file, which is imported by apache on production?

$ source env_template.sh 
$ python manage.py runserver
>>> Stage: debugging
Validating models...

In my settings file I have stuff like the following, which source sets:

AWS_ACCESS_KEY = os.environ['AWS_ACCESS_KEY']

I would like apache to load all the variables in env_template.sh on starting it. Am I able to do that in the wsgi.py file?

Upvotes: 0

Views: 53

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799240

Not in any sane manner. I recommend that you either restrict the file to simple "key=value" lines and then parse it out, or move the specific values to separate files and then read them out in both scripts.

Upvotes: 1

Related Questions