2017-11-18 102 views
2

Systemd和Gunicorn需要某种作为最后arg的以ExecStart一个WSGI文件:http://docs.gunicorn.org/en/latest/deploy.html?highlight=ExecStart#systemd如何在没有WSGI的情况下为Gunicorn配置ExecStart?

使用Django,这是主要的模块为wsgi.py

ExecStart=/home/admin/django/bin/gunicorn --config /home/admin/src/gunicorn.py --bind unix:/tmp/api.sock myapp.wsgi 

但这个文件显然不会在使用Sanic和uvloop时存在(我相信新协议被称为ASGI)。我试图将其代入app.py这勿庸置疑没有工作:

ExecStart=/home/admin/sanic/bin/gunicorn --config /home/admin/src/gunicorn.py --bind unix:/tmp/api.sock myapp.app 

如何把这个参数使用中信高科时进行配置?

回答

0

我还没有用Systend和gunicorn来部署这个。但是,documentation似乎很不错。

为了运行与Gunicorn中信高科应用程序,您需要使用Gunicorn工人类参数的特殊sanic.worker.GunicornWorker:记住,

gunicorn myapp:app --bind 0.0.0.0:1337 --worker-class sanic.worker.GunicornWorker 

有了这个这个怎么样:

ExecStart=/home/admin/sanic/bin/gunicorn --config /home/admin/src/gunicorn.py myapp:app --bind 0.0.0.0:1337 --worker-class sanic.worker.GunicornWorker 

我认为你缺少的大件是GunicornWorker工人类。

相关问题