这是我的配置文件:
/etc/supervisor/conf.d/wsgi.conf
[program:wsgi]
command=gunicorn -w 4 -b 0.0.0.0:8000 wsgi:app
directory=/home/ejior/Documents/flask/demo1 ; 项目的文件夹路径
startsecs=0 ; 启动时间
stopwaitsecs=0 ; 终止等待时间
autostart=true ; 是否自动启动
autorestart=true ; 是否自动重启
stdout_logfile=/home/ejior/Documents/flask/demo1/logs/gunicorn.log ; log 日志
stderr_logfile=/home/ejior/Documents/flask/demo1/logs/gunicorn.err ; 错误日志
报错原因是:
command那一项的gunicorn找不到,建议使用gunicorn命令的完整路径,使用 which gunicorn 查看。
所以将:
command=gunicorn -w 4 -b 0.0.0.0:8000 wsgi:app
更改为:
command=/home/ejior/.virtualenvs/begin/bin/gunicorn -w 4 -b 0.0.0.0:8000 wsgi:app
记得更改配置文件后需要先执行命令:supervisorctl reload