使用Flask的supervisor设置环境变量

时间:2016-04-12 11:39:01

标签: python flask supervisord

我的主管配置文件:

[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"

在我的Flask应用程序中,我读取了如下值:

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

但这不起作用。这些字段定义为NoneType

0 个答案:

没有答案