Supervisor not working with Gunicorn + Flask

最后都变了- 提交于 2019-12-03 14:22:33

I don't see you setting the environment in your supervisor config file:

[program:gunicorn]
environment=PYTHONPATH=/usr/local/bin:/usr/local/lib/project
command=/usr/local/bin/gunicorn my_app:app -c /path/to/.gu_setup
...

If that doesn't work, try starting gunicorn in debug mode:

command=/usr/local/bin/gunicorn --debug --log-level debug my_app:app -c /path/to/.gu_setup

Or pass the path directly to gunicorn:

command=/usr/local/bin/gunicorn --pythonpath /usr/local/bin,/usr/local/lib/project my_app:app -c /path/to/.gu_setup

EDIT: gunicorn's --pythonpath is broken, you can only pass one directory:

command=/usr/local/bin/gunicorn --pythonpath /usr/local/lib/project my_app:app -c /path/to/.gu_setup

It's not necessary pass --pythonpath. If you work virtuanenv you put add where is gunicorn. Example:

command=/home/virtualenv/bin/gunicorn application:app -c /home/virtualenv/deploy/gunicorn.conf.py

And directory is when Flask code is, Example:

directory=/home/virtualenv/myapp

Remember user is root!

user=root
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!