mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fix usage docs.
This commit is contained in:
parent
0c26280486
commit
676cf5c4f8
@ -52,27 +52,7 @@
|
|||||||
<p>Gunicorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for <tt class="docutils literal">gunicorn.conf.py</tt> in the current working directory or what ever path is specified on the command line with the <tt class="docutils literal"><span class="pre">-c</span></tt> option.</p>
|
<p>Gunicorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for <tt class="docutils literal">gunicorn.conf.py</tt> in the current working directory or what ever path is specified on the command line with the <tt class="docutils literal"><span class="pre">-c</span></tt> option.</p>
|
||||||
<div class="section" id="example-gunicorn-conf-py">
|
<div class="section" id="example-gunicorn-conf-py">
|
||||||
<h1>Example gunicorn.conf.py</h1>
|
<h1>Example gunicorn.conf.py</h1>
|
||||||
<p>arbiter="egg:gunicorn",
|
|
||||||
backlog=2048,
|
|
||||||
bind='127.0.0.1:8000',
|
|
||||||
daemon=False,
|
|
||||||
debug=False,
|
|
||||||
default_proc_name = os.getcwd(),
|
|
||||||
group=None,
|
|
||||||
keepalive=2,
|
|
||||||
logfile='-',
|
|
||||||
loglevel='info',
|
|
||||||
pidfile=None,
|
|
||||||
proc_name = None,
|
|
||||||
spew=False,
|
|
||||||
timeout=30,
|
|
||||||
tmp_upload_dir=None,
|
|
||||||
umask="0",
|
|
||||||
user=None,
|
|
||||||
workers=1,
|
|
||||||
worker_connections=1000,</p>
|
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
arbiter = "egg:gunicorn" # The arbiter to use for worker management
|
|
||||||
backlog = 2048 # The listen queue size for the server socket
|
backlog = 2048 # The listen queue size for the server socket
|
||||||
bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock"
|
bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock"
|
||||||
daemon = False # Whether work in the background
|
daemon = False # Whether work in the background
|
||||||
@ -89,6 +69,7 @@ proc_name = None # Change the process name
|
|||||||
spew=False # Display trace
|
spew=False # Display trace
|
||||||
timeout=30 # Worker timeout
|
timeout=30 # Worker timeout
|
||||||
tmp_upload_dir = None # Set path used to store temporary uploads
|
tmp_upload_dir = None # Set path used to store temporary uploads
|
||||||
|
worker_class = "egg:gunicorn#sync" # The type of request processing to use
|
||||||
worker_connections=1000 # Maximum number of simultaneous connections
|
worker_connections=1000 # Maximum number of simultaneous connections
|
||||||
|
|
||||||
after_fork=lambda server, worker: server.log.info(
|
after_fork=lambda server, worker: server.log.info(
|
||||||
@ -104,16 +85,15 @@ before_exec=lambda server: server.log.info("Forked child, reexecuting"
|
|||||||
<dl class="docutils">
|
<dl class="docutils">
|
||||||
<dt>after_fork(server, worker):</dt>
|
<dt>after_fork(server, worker):</dt>
|
||||||
<dd>This is called by the worker after initialization.</dd>
|
<dd>This is called by the worker after initialization.</dd>
|
||||||
<dt>arbiter:</dt>
|
<dt>worker_class:</dt>
|
||||||
<dd><p class="first">The arbiter manages the worker processes that actually serve clients. It
|
<dd><p class="first">Define the type of worker to use. A worker process all the requests send by
|
||||||
handles launching new workers and killing misbehaving workers among
|
the arbiter.By default the worker_class is <cite>egg:gunicorn#sync</cite>. This worker
|
||||||
other things. By default the arbiter is <cite>egg:gunicorn#main</cite>. This arbiter
|
|
||||||
only supports fast request handling requiring a buffering HTTP proxy.</p>
|
only supports fast request handling requiring a buffering HTTP proxy.</p>
|
||||||
<p class="last">If your application requires the ability to handle prolonged requests to
|
<p class="last">If your application requires the ability to handle prolonged requests to
|
||||||
provide long polling, comet, or calling an external web service you'll
|
provide long polling, comet, or calling an external web service you'll
|
||||||
need to use an async arbiter. Gunicorn has two async arbiters built in
|
need to use an async worker. Gunicorn has three async workers built in
|
||||||
using <a class="reference external" href="http://eventlet.net">Eventlet</a> or <a class="reference external" href="http://gevent.org">Gevent</a>. You can also use the Evenlet arbiter with
|
using <a class="reference external" href="http://www.tornadoweb.org/">Tornado</a>, <a class="reference external" href="http://eventlet.net">Eventlet</a> or <a class="reference external" href="http://gevent.org">Gevent</a>. You can also use the Evenlet
|
||||||
the <a class="reference external" href="http://twistedmatrix.com">Twisted</a> helper.</p>
|
worker with the <a class="reference external" href="http://twistedmatrix.com">Twisted</a> helper.</p>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>backlog:</dt>
|
<dt>backlog:</dt>
|
||||||
<dd>The backlog parameter defines the maximum length for the queue of pending
|
<dd>The backlog parameter defines the maximum length for the queue of pending
|
||||||
@ -156,6 +136,8 @@ installed. This alters the process names listed by commands like <tt class="docu
|
|||||||
<dt>worker_connections:</dt>
|
<dt>worker_connections:</dt>
|
||||||
<dd>Number of simultaneous connections a worker can handle when used with
|
<dd>Number of simultaneous connections a worker can handle when used with
|
||||||
Eventlet or Gevent arbiter. The default is 1000.</dd>
|
Eventlet or Gevent arbiter. The default is 1000.</dd>
|
||||||
|
<dt>timeout:</dt>
|
||||||
|
<dd>Set worker timeout.</dd>
|
||||||
<dt>tmp_upload_dir:</dt>
|
<dt>tmp_upload_dir:</dt>
|
||||||
<dd>Set the path used to store temporarily the body of the request.</dd>
|
<dd>Set the path used to store temporarily the body of the request.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@ -50,6 +50,13 @@
|
|||||||
<div class="document" id="news">
|
<div class="document" id="news">
|
||||||
<h1 class="title">News</h1>
|
<h1 class="title">News</h1>
|
||||||
<div class="section" id="id1">
|
<div class="section" id="id1">
|
||||||
|
<h1>0.8.0 / 2004-04-22</h1>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Refactored Worker management for better async support. Now use the -k option to set the type of request processing to use</li>
|
||||||
|
<li>Added support for <a class="reference external" href="http://www.tornadoweb.org/">Tornado</a> .</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="id2">
|
||||||
<h1>0.7.2 / 2010-04-15</h1>
|
<h1>0.7.2 / 2010-04-15</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Added --spew option to help debugging (install a Trace hook)</li>
|
<li>Added --spew option to help debugging (install a Trace hook)</li>
|
||||||
@ -57,13 +64,13 @@
|
|||||||
<li>Fix a bug in start_response on error</li>
|
<li>Fix a bug in start_response on error</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id2">
|
<div class="section" id="id3">
|
||||||
<h1>0.7.1 / 2010-04-01</h1>
|
<h1>0.7.1 / 2010-04-01</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Fix bug when responses have no body.</li>
|
<li>Fix bug when responses have no body.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id3">
|
<div class="section" id="id4">
|
||||||
<h1>0.7.0 / 2010-03-26</h1>
|
<h1>0.7.0 / 2010-03-26</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Added support for <a class="reference external" href="faq.html">sleepy applications</a> using <a class="reference external" href="http://eventlet.net">Eventlet</a> or <a class="reference external" href="http://gevent.org">Gevent</a>.</li>
|
<li>Added support for <a class="reference external" href="faq.html">sleepy applications</a> using <a class="reference external" href="http://eventlet.net">Eventlet</a> or <a class="reference external" href="http://gevent.org">Gevent</a>.</li>
|
||||||
@ -73,28 +80,28 @@
|
|||||||
<li>Fix <a class="reference external" href="http://www.python.org/dev/peps/pep-0333/">PEP 333</a> compliance for the write callable.</li>
|
<li>Fix <a class="reference external" href="http://www.python.org/dev/peps/pep-0333/">PEP 333</a> compliance for the write callable.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id4">
|
<div class="section" id="id5">
|
||||||
<h1>0.6.5 / 2010-03-11</h1>
|
<h1>0.6.5 / 2010-03-11</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Fix pidfile</li>
|
<li>Fix pidfile</li>
|
||||||
<li>Fix Exception Error</li>
|
<li>Fix Exception Error</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id5">
|
<div class="section" id="id6">
|
||||||
<h1>0.6.4 / 2010-03-08</h1>
|
<h1>0.6.4 / 2010-03-08</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Use cStringIO for performance when possible.</li>
|
<li>Use cStringIO for performance when possible.</li>
|
||||||
<li>Fix worker freeze when a remote connection closes unexpectedly.</li>
|
<li>Fix worker freeze when a remote connection closes unexpectedly.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id6">
|
<div class="section" id="id7">
|
||||||
<h1>0.6.3 / 2010-03-07</h1>
|
<h1>0.6.3 / 2010-03-07</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Make HTTP parsing faster.</li>
|
<li>Make HTTP parsing faster.</li>
|
||||||
<li>Some fixes (see <a class="reference external" href="http://github.com/benoitc/gunicorn/commits/master">logs</a>)</li>
|
<li>Some fixes (see <a class="reference external" href="http://github.com/benoitc/gunicorn/commits/master">logs</a>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id7">
|
<div class="section" id="id8">
|
||||||
<h1>0.6.2 / 2010-03-01</h1>
|
<h1>0.6.2 / 2010-03-01</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Added support for chunked response.</li>
|
<li>Added support for chunked response.</li>
|
||||||
@ -104,7 +111,7 @@
|
|||||||
<li>Workers are now murdered by age (the oldest is killed first).</li>
|
<li>Workers are now murdered by age (the oldest is killed first).</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id8">
|
<div class="section" id="id9">
|
||||||
<h1>0.6.1 / 2010-02-24</h1>
|
<h1>0.6.1 / 2010-02-24</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Added gunicorn config file support for django admin command</li>
|
<li>Added gunicorn config file support for django admin command</li>
|
||||||
@ -112,21 +119,21 @@
|
|||||||
<li>Removed TTIN/TTOU from workers which blocked other signals.</li>
|
<li>Removed TTIN/TTOU from workers which blocked other signals.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id9">
|
<div class="section" id="id10">
|
||||||
<h1>0.6 / 2010-02-22</h1>
|
<h1>0.6 / 2010-02-22</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Added setproctitle</li>
|
<li>Added setproctitle</li>
|
||||||
<li>Change privilege switch behaviour. We now work like NGINX, master keeps the permissions, new uid/gid permissions are only set for workers.</li>
|
<li>Change privilege switch behaviour. We now work like NGINX, master keeps the permissions, new uid/gid permissions are only set for workers.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id10">
|
<div class="section" id="id11">
|
||||||
<h1>0.5.1 / 2010-02-22</h1>
|
<h1>0.5.1 / 2010-02-22</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Fix umask</li>
|
<li>Fix umask</li>
|
||||||
<li>Added debian packaging</li>
|
<li>Added debian packaging</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id11">
|
<div class="section" id="id12">
|
||||||
<h1>0.5 / 2010-02-20</h1>
|
<h1>0.5 / 2010-02-20</h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Added <a class="reference external" href="configuration.html">configuration file</a> handler.</li>
|
<li>Added <a class="reference external" href="configuration.html">configuration file</a> handler.</li>
|
||||||
|
|||||||
@ -59,19 +59,19 @@
|
|||||||
<p>To launch the <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/test.py">example application</a> packaged with Gunicorn:</p>
|
<p>To launch the <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/test.py">example application</a> packaged with Gunicorn:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
$ cd /path/to/gunicorn/examples/
|
$ cd /path/to/gunicorn/examples/
|
||||||
$ gunicorn --workers=2 test:app
|
$ gunicorn -w 2 test:app
|
||||||
</pre>
|
</pre>
|
||||||
<p>The module <tt class="docutils literal">test:app</tt> specifies the complete module name and WSGI callable.
|
<p>The module <tt class="docutils literal">test:app</tt> specifies the complete module name and WSGI callable.
|
||||||
You can replace it with anything that is available on your <tt class="docutils literal">PYTHONPATH</tt> like
|
You can replace it with anything that is available on your <tt class="docutils literal">PYTHONPATH</tt> like
|
||||||
such:</p>
|
such:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
$ cd ~/
|
$ cd ~/
|
||||||
$ gunicorn --workers=12 awesomeproject.wsgi.main:main_app
|
$ gunicorn -w 12 awesomeproject.wsgi.main:main_app
|
||||||
</pre>
|
</pre>
|
||||||
<p>To launch the <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/websocket.py">websocket example</a> application using <a class="reference external" href="http://eventlet.net">Eventlet</a>:</p>
|
<p>To launch the <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/websocket.py">websocket example</a> application using <a class="reference external" href="http://eventlet.net">Eventlet</a>:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
$ cd /path/to/gunicorn/examples/
|
$ cd /path/to/gunicorn/examples/
|
||||||
$ gunicorn -w 12 -a "egg:gunicorn#eventlet" websocket:app
|
$ gunicorn -w 12 -k "egg:gunicorn#eventlet" websocket:app
|
||||||
</pre>
|
</pre>
|
||||||
<p>You should then be able to visit <tt class="docutils literal"><span class="pre">http://localhost:8000</span></tt> to see output.</p>
|
<p>You should then be able to visit <tt class="docutils literal"><span class="pre">http://localhost:8000</span></tt> to see output.</p>
|
||||||
<div class="section" id="full-command-line-usage">
|
<div class="section" id="full-command-line-usage">
|
||||||
@ -85,11 +85,11 @@ Options:
|
|||||||
Config file. [none]
|
Config file. [none]
|
||||||
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
||||||
unix:/tmp/gunicorn.sock
|
unix:/tmp/gunicorn.sock
|
||||||
|
-k WORKERCLASS, --worker-class=WORKERCLASS
|
||||||
|
The type of request processing to use
|
||||||
|
[egg:gunicorn#sync]
|
||||||
-w WORKERS, --workers=WORKERS
|
-w WORKERS, --workers=WORKERS
|
||||||
Number of workers to spawn. [1]
|
Number of workers to spawn. [1]
|
||||||
-a ARBITER, --arbiter=ARBITER
|
|
||||||
gunicorn arbiter entry point or module
|
|
||||||
[egg:gunicorn#main]
|
|
||||||
-p PIDFILE, --pid=PIDFILE
|
-p PIDFILE, --pid=PIDFILE
|
||||||
set the background PID FILE
|
set the background PID FILE
|
||||||
-D, --daemon Run daemonized in the background.
|
-D, --daemon Run daemonized in the background.
|
||||||
|
|||||||
@ -14,19 +14,19 @@ WSGI applications
|
|||||||
To launch the `example application`_ packaged with Gunicorn::
|
To launch the `example application`_ packaged with Gunicorn::
|
||||||
|
|
||||||
$ cd /path/to/gunicorn/examples/
|
$ cd /path/to/gunicorn/examples/
|
||||||
$ gunicorn --workers=2 test:app
|
$ gunicorn -w 2 test:app
|
||||||
|
|
||||||
The module ``test:app`` specifies the complete module name and WSGI callable.
|
The module ``test:app`` specifies the complete module name and WSGI callable.
|
||||||
You can replace it with anything that is available on your ``PYTHONPATH`` like
|
You can replace it with anything that is available on your ``PYTHONPATH`` like
|
||||||
such::
|
such::
|
||||||
|
|
||||||
$ cd ~/
|
$ cd ~/
|
||||||
$ gunicorn --workers=12 awesomeproject.wsgi.main:main_app
|
$ gunicorn -w 12 awesomeproject.wsgi.main:main_app
|
||||||
|
|
||||||
To launch the `websocket example`_ application using `Eventlet`_::
|
To launch the `websocket example`_ application using `Eventlet`_::
|
||||||
|
|
||||||
$ cd /path/to/gunicorn/examples/
|
$ cd /path/to/gunicorn/examples/
|
||||||
$ gunicorn -w 12 -a "egg:gunicorn#eventlet" websocket:app
|
$ gunicorn -w 12 -k "egg:gunicorn#eventlet" websocket:app
|
||||||
|
|
||||||
You should then be able to visit ``http://localhost:8000`` to see output.
|
You should then be able to visit ``http://localhost:8000`` to see output.
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ Full command line usage
|
|||||||
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
||||||
unix:/tmp/gunicorn.sock
|
unix:/tmp/gunicorn.sock
|
||||||
-k WORKERCLASS, --worker-class=WORKERCLASS
|
-k WORKERCLASS, --worker-class=WORKERCLASS
|
||||||
The type of request processing to use
|
The type of request processing to use
|
||||||
[egg:gunicorn#sync]
|
[egg:gunicorn#sync]
|
||||||
-w WORKERS, --workers=WORKERS
|
-w WORKERS, --workers=WORKERS
|
||||||
Number of workers to spawn. [1]
|
Number of workers to spawn. [1]
|
||||||
-p PIDFILE, --pid=PIDFILE
|
-p PIDFILE, --pid=PIDFILE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user