2017-11-18 103 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工人類。

相關問題