Python: supervisor 配置文件来执行 gunicorn

Python: supervisor configure file to execute gunicorn

python 新手,我使用 Flask+gunicorn+supervisor+ngnix 运行 服务器。每个都设置好,我的问题是我不能使用 supervisor 让 gunicorn 执行 运行 一些执行。
以下是文件的层次结构:

.  
├── logs  
│   ├── access.log  
│   └── gunicorn_supervisor.log  
└── tserver  
    ├── bin  
    ├── build  
    ├── flasky   
    │   ├── @   
    │   ├── app  
    │   ├── hello.py  
    │   ├── LICENSE   
    │   └── README.md    
    ├── gunicorn.conf  
    ├── include  
    ├── lib  
    ├── local  
    └── pip-selfcheck.json   

tserver 由 virtualenv 创建。

/etc/supervisor/conf.d/tserver.conf :

[program:tserver]
command=/home/jason/tserver/bin/gunicorn hello:app -c /home/jason/tserver/gunicorn.conf
directory=/home/jason/tserver/
user=jason
autostart=true
autorestart=true
stdout_logfile=/home/jason/logs/gunicorn_supervisor.log

我的目的是让supervisor把gunicorn做成运行 hello.py,但是不行。我用sudo supervisor status查看状态发现:

tserver      FATAL      Exited too quickly (process log may have details) 

我强烈感觉问题一定出在tserver.conf,尤其是command

查看文件,hello.py 在名为 "flasky" 的文件中,所以 command=/home/jason/tserver/bin/gunicorn hello:app -c /home/jason/tserver/gunicorn.conf 我认为路径有问题。但是command=/home/jason/tserver/bin/gunicorn ./hello:app -c /home/jason/tserver/gunicorn.conf还是不行。

而且我认为这对于有经验的人来说是一个非常愚蠢的问题,但是作为一个新手我被卡住了,所以请给我一个详细的解决方案,因为我已经阅读了相关文档但没有得到它。感谢您的青睐。

终于发现我的错误,我把自己的env scp到服务器,导致gunicorn无法运行。我不知道原因,但是当我重新安装 env 和 gunicorn 时,它起作用了。

此外,hello.pyflasky中,所以tserver.conf中的directory应该是:

directory=/home/jason/tserver/flasky/