This commit is contained in:
benoitc 2010-03-27 10:08:35 +01:00
parent c164650c6d
commit 1d047c0aa9
5 changed files with 26 additions and 25 deletions

View File

@ -49,7 +49,7 @@
<div class="document" id="the-configuration-file"> <div class="document" id="the-configuration-file">
<h1 class="title">The Configuration File</h1> <h1 class="title">The Configuration File</h1>
<p>Gunciorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for <tt class="docutils literal"><span class="pre">gunicorn.conf.py</span></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>
<pre class="literal-block"> <pre class="literal-block">
@ -104,13 +104,13 @@ connections. The default is 2048. See listen(2) for more information</dd>
the master receives a HUP or USR2 signal.</dd> the master receives a HUP or USR2 signal.</dd>
<dt>bind:</dt> <dt>bind:</dt>
<dd>The address on which workers are listening. It can be a TCP address with a <dd>The address on which workers are listening. It can be a TCP address with a
format of <tt class="docutils literal"><span class="pre">IP:PORT</span></tt> or a Unix socket address like format of <tt class="docutils literal">IP:PORT</tt> or a Unix socket address like
<tt class="docutils literal"><span class="pre">unix:/path/to/socketfile</span></tt>.</dd> <tt class="docutils literal"><span class="pre">unix:/path/to/socketfile</span></tt>.</dd>
<dt>daemon:</dt> <dt>daemon:</dt>
<dd>Whether or not to detach the server from the controlling terminal.</dd> <dd>Whether or not to detach the server from the controlling terminal.</dd>
<dt>debug:</dt> <dt>debug:</dt>
<dd>If <tt class="docutils literal"><span class="pre">True</span></tt>, only one worker will be launch and the variable <dd>If <tt class="docutils literal">True</tt>, only one worker will be launch and the variable
<tt class="docutils literal"><span class="pre">wsgi.multiprocess</span></tt> will be set to False.</dd> <tt class="docutils literal">wsgi.multiprocess</tt> will be set to False.</dd>
<dt>group:</dt> <dt>group:</dt>
<dd>The group in which worker processes will be launched.</dd> <dd>The group in which worker processes will be launched.</dd>
<dt>keepalive:</dt> <dt>keepalive:</dt>
@ -119,15 +119,15 @@ most conditions for browsers to render the page and start retrieving extra
elements for. Increasing this beyond 5 seconds is not recommended. Zero elements for. Increasing this beyond 5 seconds is not recommended. Zero
disables KeepAlive entirely.</dd> disables KeepAlive entirely.</dd>
<dt>logfile:</dt> <dt>logfile:</dt>
<dd>The path to the log file <tt class="docutils literal"><span class="pre">-</span></tt> (stdout) by default.</dd> <dd>The path to the log file <tt class="docutils literal">-</tt> (stdout) by default.</dd>
<dt>loglevel:</dt> <dt>loglevel:</dt>
<dd>The level at which to log. <tt class="docutils literal"><span class="pre">info</span></tt>, <tt class="docutils literal"><span class="pre">debug</span></tt>, or <tt class="docutils literal"><span class="pre">error</span></tt> for instance. <dd>The level at which to log. <tt class="docutils literal">info</tt>, <tt class="docutils literal">debug</tt>, or <tt class="docutils literal">error</tt> for instance.
Only log messages of equal or greater severity are logged.</dd> Only log messages of equal or greater severity are logged.</dd>
<dt>pidfile:</dt> <dt>pidfile:</dt>
<dd>A file to store the master's PID.</dd> <dd>A file to store the master's PID.</dd>
<dt>proc_name:</dt> <dt>proc_name:</dt>
<dd>A name for the master process. Only takes effect if <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a> is <dd>A name for the master process. Only takes effect if <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a> is
installed. This alters the process names listed by commands like <tt class="docutils literal"><span class="pre">ps</span></tt>.</dd> installed. This alters the process names listed by commands like <tt class="docutils literal">ps</tt>.</dd>
<dt>umask:</dt> <dt>umask:</dt>
<dd>Used to set the umask when daemonizing.</dd> <dd>Used to set the umask when daemonizing.</dd>
<dt>user:</dt> <dt>user:</dt>

View File

@ -84,8 +84,8 @@ $ kill -TTOU $masterpid
</pre> </pre>
</dd> </dd>
<dt>How do I set SCRIPT_NAME?</dt> <dt>How do I set SCRIPT_NAME?</dt>
<dd>By default <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> is an empy string. The value could be set by <dd>By default <tt class="docutils literal">SCRIPT_NAME</tt> is an empy string. The value could be set by
setting <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> in the environment or as an HTTP header.</dd> setting <tt class="docutils literal">SCRIPT_NAME</tt> in the environment or as an HTTP header.</dd>
<dt>How to name processes?</dt> <dt>How to name processes?</dt>
<dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can name <dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can name
your process with <cite>-n</cite> or just let the default. If you use a configuration your process with <cite>-n</cite> or just let the default. If you use a configuration

View File

@ -59,8 +59,8 @@
</div> </div>
<div class="section" id="installing-with-easy-install"> <div class="section" id="installing-with-easy-install">
<h1>Installing with easy_install</h1> <h1>Installing with easy_install</h1>
<p>If you don't already have <tt class="docutils literal"><span class="pre">easy_install</span></tt> available you'll want to download <p>If you don't already have <tt class="docutils literal">easy_install</tt> available you'll want to download
and run the <tt class="docutils literal"><span class="pre">ez_setup.py</span></tt> script:</p> and run the <tt class="docutils literal">ez_setup.py</tt> script:</p>
<pre class="literal-block"> <pre class="literal-block">
$ curl -O http://peak.telecommunity.com/dist/ez_setup.py $ curl -O http://peak.telecommunity.com/dist/ez_setup.py
$ sudo python ez_setup.py -U setuptools $ sudo python ez_setup.py -U setuptools
@ -89,7 +89,7 @@ $ git clone git://github.com/benoitc/gunicorn.git
$ python setup.py install $ python setup.py install
</pre> </pre>
<p>If you've cloned the git repository, its highly recommended that you use the <p>If you've cloned the git repository, its highly recommended that you use the
<tt class="docutils literal"><span class="pre">develop</span></tt> command which will allow you to use Gunicorn from the source <tt class="docutils literal">develop</tt> command which will allow you to use Gunicorn from the source
directory. This will allow you to keep up to date with development on GitHub as directory. This will allow you to keep up to date with development on GitHub as
well as make changes to the source:</p> well as make changes to the source:</p>
<pre class="literal-block"> <pre class="literal-block">
@ -105,13 +105,13 @@ $ python setup.py develop
<pre class="literal-block"> <pre class="literal-block">
$ easy_install -U eventlet $ easy_install -U eventlet
</pre> </pre>
<p>Replace <tt class="docutils literal"><span class="pre">eventlet</span></tt> with <tt class="docutils literal"><span class="pre">gevent</span></tt> if you want to use the <tt class="docutils literal"><span class="pre">gevent</span></tt> <p>Replace <tt class="docutils literal">eventlet</tt> with <tt class="docutils literal">gevent</tt> if you want to use the <tt class="docutils literal">gevent</tt>
arbiter.</p> arbiter.</p>
<p>You can now launch gunicorn with Eventlet or Gevent arbiter, see <p>You can now launch gunicorn with Eventlet or Gevent arbiter, see
<a class="reference external" href="usage.html">usage</a> for more information.</p> <a class="reference external" href="usage.html">usage</a> for more information.</p>
<div class="note"> <div class="note">
<p class="first admonition-title">Note</p> <p class="first admonition-title">Note</p>
<p class="last">If <tt class="docutils literal"><span class="pre">eventlet</span></tt> or <tt class="docutils literal"><span class="pre">gevent</span></tt> fails to install for you, its most likely <p class="last">If <tt class="docutils literal">eventlet</tt> or <tt class="docutils literal">gevent</tt> fails to install for you, its most likely
due to an out of date <a class="reference external" href="http://software.schmorp.de/pkg/libev.html">libev</a> library. You'll need to download and install due to an out of date <a class="reference external" href="http://software.schmorp.de/pkg/libev.html">libev</a> library. You'll need to download and install
a newer version for either of those to modules to work properly.</p> a newer version for either of those to modules to work properly.</p>
</div> </div>
@ -119,7 +119,7 @@ a newer version for either of those to modules to work properly.</p>
<div class="section" id="installing-on-ubuntu-debian-systems"> <div class="section" id="installing-on-ubuntu-debian-systems">
<h1>Installing on Ubuntu/Debian systems</h1> <h1>Installing on Ubuntu/Debian systems</h1>
<p>If you use <a class="reference external" href="http://www.ubuntu.com/">Ubuntu</a> karmic, you can update your <p>If you use <a class="reference external" href="http://www.ubuntu.com/">Ubuntu</a> karmic, you can update your
system with packages from our <a class="reference external" href="https://launchpad.net/~bchesneau/+archive/gunicorn">PPA</a> by adding <tt class="docutils literal"><span class="pre">ppa:bchesneau/gunicorn</span></tt> system with packages from our <a class="reference external" href="https://launchpad.net/~bchesneau/+archive/gunicorn">PPA</a> by adding <tt class="docutils literal">ppa:bchesneau/gunicorn</tt>
to your system's Software Sources.</p> to your system's Software Sources.</p>
<p>Or this PPA can be added to your system manually by copying the lines below <p>Or this PPA can be added to your system manually by copying the lines below
and adding them to your system's software sources:</p> and adding them to your system's software sources:</p>

View File

@ -61,8 +61,8 @@
$ cd /path/to/gunicorn/examples/ $ cd /path/to/gunicorn/examples/
$ gunicorn --workers=2 test:app $ gunicorn --workers=2 test:app
</pre> </pre>
<p>The module <tt class="docutils literal"><span class="pre">test:app</span></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"><span class="pre">PYTHONPATH</span></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 ~/
@ -111,14 +111,14 @@ Options:
<div class="section" id="django-projects"> <div class="section" id="django-projects">
<h1>Django Projects</h1> <h1>Django Projects</h1>
<p><a class="reference external" href="http://djangoproject.com">Django</a> projects can be handled easily by Gunicorn using the <p><a class="reference external" href="http://djangoproject.com">Django</a> projects can be handled easily by Gunicorn using the
<tt class="docutils literal"><span class="pre">gunicorn_django</span></tt> command:</p> <tt class="docutils literal">gunicorn_django</tt> command:</p>
<pre class="literal-block"> <pre class="literal-block">
$ cd $yourdjangoproject $ cd $yourdjangoproject
$ gunicorn_django --workers=2 $ gunicorn_django --workers=2
</pre> </pre>
<p>But you can also use the <tt class="docutils literal"><span class="pre">run_gunicorn</span></tt> <a class="reference external" href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/">admin command</a> like the other <p>But you can also use the <tt class="docutils literal">run_gunicorn</tt> <a class="reference external" href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/">admin command</a> like the other
<tt class="docutils literal"><span class="pre">management.py</span></tt> commands.</p> <tt class="docutils literal">management.py</tt> commands.</p>
<p>Add <tt class="docutils literal"><span class="pre">&quot;gunicorn&quot;</span></tt> to INSTALLED_APPS in your settings file:</p> <p>Add <tt class="docutils literal">&quot;gunicorn&quot;</tt> to INSTALLED_APPS in your settings file:</p>
<pre class="literal-block"> <pre class="literal-block">
INSTALLED_APPS = ( INSTALLED_APPS = (
... ...
@ -133,12 +133,12 @@ python manage.py run_gunicorn
<div class="section" id="paste-compatible-projects"> <div class="section" id="paste-compatible-projects">
<h1>Paste-compatible projects</h1> <h1>Paste-compatible projects</h1>
<p>For <a class="reference external" href="http://pythonpaste.org/script/">Paste</a> compatible projects (<a class="reference external" href="http://pylonshq.com/">Pylons</a>, <a class="reference external" href="http://turbogears.org/2.0/">TurboGears 2</a>, ...) use the <p>For <a class="reference external" href="http://pythonpaste.org/script/">Paste</a> compatible projects (<a class="reference external" href="http://pylonshq.com/">Pylons</a>, <a class="reference external" href="http://turbogears.org/2.0/">TurboGears 2</a>, ...) use the
<tt class="docutils literal"><span class="pre">gunicorn_paste</span></tt> command:</p> <tt class="docutils literal">gunicorn_paste</tt> command:</p>
<pre class="literal-block"> <pre class="literal-block">
$ cd $yourpasteproject $ cd $yourpasteproject
$ gunicorn_paste --workers=2 development.ini $ gunicorn_paste --workers=2 development.ini
</pre> </pre>
<p>To use the <tt class="docutils literal"><span class="pre">paster</span></tt> command add a sever section for Gunicorn:</p> <p>To use the <tt class="docutils literal">paster</tt> command add a sever section for Gunicorn:</p>
<pre class="literal-block"> <pre class="literal-block">
[server:main] [server:main]
use = egg:gunicorn#main use = egg:gunicorn#main

View File

@ -4,7 +4,7 @@ title: The Configuration File
The Configuration File The Configuration File
====================== ======================
Gunciorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for ``gunicorn.conf.py`` in the current working directory or what ever path is specified on the command line with the ``-c`` option. Gunicorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for ``gunicorn.conf.py`` in the current working directory or what ever path is specified on the command line with the ``-c`` option.
Example gunicorn.conf.py Example gunicorn.conf.py
------------------------ ------------------------
@ -115,4 +115,5 @@ tmp_upload_dir:
.. _Eventlet: http://eventlet.net .. _Eventlet: http://eventlet.net
.. _Gevent: http://gevent.org .. _Gevent: http://gevent.org
.. _Twisted: http://twistedmatrix.com .. _Twisted: http://twistedmatrix.com
.. _setproctitle: http://pypi.python.org/pypi/setproctitle .. _setproctitle: http://pypi.python.org/pypi/setproctitle