2

My supervisor configuration file:

[program:dashboard]
command = /home/ubuntu/dashboard/bin/gunicorn manage:app -w 4
directory = /home/ubuntu/dashboard
autostart=true
autorestart=true
user = ubuntu
stdout_logfile = /home/ubuntu/dashboard/logs/gunicorn/gunicorn_stdout.log
stderr_logfile = /home/ubuntu/dashboard/logs/gunicorn/gunicorn_stderr.log
redirect_stderr = True
environment=SECRET_KEY="a_key",FLASK_CONFIG="production",DB_HOST="a_host",DB_PASSWORD="a_password",DB_USERNAME="a_username"

In my Flask app I read the values like:

DB_HOST = os.environ.get('DB_HOST')
DB_USERNAME = os.environ.get('DB_USERNAME')
DB_PASSWORD = os.environ.get('DB_PASSWORD')

But this doesn't work. These fields are defined as NoneType.

Galil
  • 859
  • 2
  • 16
  • 40
  • Related: http://stackoverflow.com/questions/12900402/supervisor-and-environment-variables – OneCricketeer Apr 12 '16 at 11:46
  • I've seen this one, but in my case the environment variables did not exist before and they are separated by commas. – Galil Apr 12 '16 at 11:51
  • Related: http://serverfault.com/questions/742059/after-configuring-nginx-reverse-proxy-and-gunicorn-env-variables-stop-being-d – iurisilvio Apr 12 '16 at 12:54
  • I changed my configuration file to: `command = /home/ubuntu/dashboard/bin/gunicorn -e DB_HOST="a_host" -e DB_USERNAME="a_username" -e DB_PASSWORD="a_password" manage:app -w 4` But it did not work either. – Galil Apr 12 '16 at 15:33
  • Are you still having this issue? I had success when I moved my `environment` list under `user` and above `stdout_logfile`. Thought these things were position independent, but maybe not 100% true? Just a guess, but it might help resolve your problem. – peachykeen Oct 05 '18 at 14:44

0 Answers0