Merge pull request #578 from messense/feature/gunicorn-deploy-doc

Add documentation for Gunicorn worker
This commit is contained in:
Raphael Deem 2017-03-23 12:20:00 -07:00 committed by GitHub
commit 563bc34fb5

View File

@ -44,3 +44,15 @@ directly run by the interpreter.
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=1337, workers=4) app.run(host='0.0.0.0', port=1337, workers=4)
``` ```
## Running via Gunicorn
[Gunicorn](http://gunicorn.org/) Green Unicorn is a WSGI HTTP Server for UNIX.
Its a pre-fork worker model ported from Rubys Unicorn project.
In order to run Sanic application with Gunicorn, you need to use the special `sanic.worker.GunicornWorker`
for Gunicorn `worker-class` argument:
```
gunicorn --bind 0.0.0.0:1337 --worker-class sanic.worker.GunicornWorker
```