Gunicorn service can't read environment variables
I am having some troubles to configure a Django app (using virtualenv) with Postgres, Nginx, and Gunicorn on Ubuntu 16.04.
Everything worked fine until I started setting some environment variables for some Django configuration variables. Ex.: SECRETKEY = os.environ[‘DJANGOSECRET_KEY’].
I have tried a lot of options like setting variables on virtualenv’s activate file, setting variables on ubuntu, and on gunicorn.service file but nothing is working.
Does anyone know how to work on this issue? How to set the environment variables?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.