I am using uWSGI to run a Django application on nginx. I have configured the server and all seems to be running well. What I would really like to be able to do is store the django secret key within the systems environment variables so it is not part of the settings.py file.

I know that somewhere within the uwsgi options there is the ability to pass through multiple environment settings; but I cannot find this. Can someone please tell me how this is done.

2 Answers 2


Use the uwsgi_param PARAM_NAME 'param_value'; then access with request.environ['PARAM_NAME']


That worked for me was append to wsgi.ini file:

env = PARAM_NAME=param_value

Not needed to add " or ' or end with semicolon. If you don't know where is xxx.ini you can see nginx file in /etc/nginx/sites-enabled

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.