From 3d9927dee037fcb67dc92f56768a1eacad25a2a6 Mon Sep 17 00:00:00 2001 From: messense Date: Thu, 23 Mar 2017 09:12:23 +0800 Subject: [PATCH] Add documentation for Gunicorn worker --- docs/sanic/deploying.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/sanic/deploying.md b/docs/sanic/deploying.md index d5f3ad06..cc89759b 100644 --- a/docs/sanic/deploying.md +++ b/docs/sanic/deploying.md @@ -44,3 +44,15 @@ directly run by the interpreter. if __name__ == '__main__': 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. +It’s a pre-fork worker model ported from Ruby’s 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 +```