Merge branch 'master' of github.com:benoitc/gunicorn

Conflicts:
	doc/site/news.rst
This commit is contained in:
benoitc 2010-05-25 18:01:39 +02:00
commit b0c390ec22
5 changed files with 37 additions and 31 deletions

View File

@ -89,7 +89,7 @@ class Page(object):
return "/".join([self.site.url, path])
def needed(self):
for f in "force --force -f":
for f in "force --force -f".split():
if f in sys.argv[1:]:
return True

View File

@ -135,8 +135,8 @@ http {
features like Comet, Long polling, or Web sockets, you need to turn off the
proxy buffering. <strong>When you do this</strong> you must run with one of the async worker
classes.</p>
<p>To turn off buffering, you only need to add <tt class="docutils literal"><span class="pre">proxy_buffering</span> <span class="pre">off;</span></tt> to your
<tt class="docutils literal"><span class="pre">location</span></tt> block:</p>
<p>To turn off buffering, you only need to add <tt class="docutils literal">proxy_buffering off;</tt> to your
<tt class="docutils literal">location</tt> block:</p>
<pre class="literal-block">
...
location / {
@ -168,7 +168,7 @@ $ ~/venvs/webapp/bin/easy_install -U gunicorn
$ deactivate
</pre>
<p>Then you just need to use one of the three Gunicorn scripts that was installed
into <tt class="docutils literal"><span class="pre">~/venvs/webapp/bin</span></tt>.</p>
into <tt class="docutils literal">~/venvs/webapp/bin</tt>.</p>
</div>
<div class="section" id="daemon-monitoring">
<h1>Daemon Monitoring</h1>

View File

@ -55,12 +55,12 @@
<a class="reference external" href="http://gunicorn.org/deployment.html">deployment</a> page. Test some more.</dd>
<dt>What types of workers are there?</dt>
<dd><p class="first">These can all be used with the <tt class="docutils literal"><span class="pre">-k</span></tt> option and specifying them
as <tt class="docutils literal"><span class="pre">egg:gunicorn#$(NAME)</span></tt> where <tt class="docutils literal"><span class="pre">$(NAME)</span></tt> is chosen from this list.</p>
as <tt class="docutils literal"><span class="pre">egg:gunicorn#$(NAME)</span></tt> where <tt class="docutils literal">$(NAME)</tt> is chosen from this list.</p>
<ul class="last simple">
<li><tt class="docutils literal"><span class="pre">sync</span></tt> - The default synchronous worker</li>
<li><tt class="docutils literal"><span class="pre">eventlet</span></tt> - Asynchronous workers based on Greenlets</li>
<li><tt class="docutils literal"><span class="pre">gevent</span></tt> - Asynchronous workers based on Greenlets</li>
<li><tt class="docutils literal"><span class="pre">tornado</span></tt> - Asynchronous workers based on FriendFeed's Tornado server.</li>
<li><tt class="docutils literal">sync</tt> - The default synchronous worker</li>
<li><tt class="docutils literal">eventlet</tt> - Asynchronous workers based on Greenlets</li>
<li><tt class="docutils literal">gevent</tt> - Asynchronous workers based on Greenlets</li>
<li><tt class="docutils literal">tornado</tt> - Asynchronous workers based on FriendFeed's Tornado server.</li>
</ul>
</dd>
<dt>How might I test a proxy configuration?</dt>
@ -87,8 +87,8 @@ $ kill -TTOU $masterpid
<dd>Start gunicorn with an approximate number of worker processes. Then use the
TTIN and/or TTOU signals to adjust the number of workers under load.</dd>
<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
setting <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> in the environment or as an HTTP header.</dd>
<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">SCRIPT_NAME</tt> in the environment or as an HTTP header.</dd>
<dt>How can I 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 specify
a base process name on the command line (<tt class="docutils literal"><span class="pre">-n</span></tt>) or in the configuration

View File

@ -59,8 +59,8 @@
</div>
<div class="section" id="installing-with-easy-install">
<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
and run the <tt class="docutils literal"><span class="pre">ez_setup.py</span></tt> script:</p>
<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">ez_setup.py</tt> script:</p>
<pre class="literal-block">
$ curl -O http://peak.telecommunity.com/dist/ez_setup.py
$ sudo python ez_setup.py -U setuptools
@ -89,7 +89,7 @@ $ git clone git://github.com/benoitc/gunicorn.git
$ python setup.py install
</pre>
<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
well as make changes to the source:</p>
<pre class="literal-block">
@ -111,20 +111,20 @@ $ easy_install -U gevent # For gevent workers
</pre>
<div class="note">
<p class="first admonition-title">Note</p>
<p>If installing <tt class="docutils literal"><span class="pre">greenlet</span></tt> fails you probably need to install
<p>If installing <tt class="docutils literal">greenlet</tt> fails you probably need to install
the Python headers. These headers are available in most package
managers. On Ubuntu the package name for <tt class="docutils literal"><span class="pre">apt-get</span></tt> is
<tt class="docutils literal"><span class="pre">python-dev</span></tt>.</p>
<p class="last"><a class="reference external" href="http://gevent.org">Gevent</a> also requires that <tt class="docutils literal"><span class="pre">libevent</span></tt> 1.4.x or 2.0.4 is installed.
<p class="last"><a class="reference external" href="http://gevent.org">Gevent</a> also requires that <tt class="docutils literal">libevent</tt> 1.4.x or 2.0.4 is installed.
This could be a more recent version than what is available in your
package manager. If <a class="reference external" href="http://gevent.org">Gevent</a> fails to build even with <tt class="docutils literal"><span class="pre">libevent</span></tt>
package manager. If <a class="reference external" href="http://gevent.org">Gevent</a> fails to build even with <tt class="docutils literal">libevent</tt>
installed, this is the most likely reason.</p>
</div>
</div>
<div class="section" id="installing-on-ubuntu-debian-systems">
<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 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> to your system's Software
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>
<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>

View File

@ -181,6 +181,8 @@ def validate_pos_int(val):
return val
def validate_string(val):
if val is None:
return None
if not isinstance(val, basestring):
raise TypeError("Not a string: %s" % val)
return val.strip()
@ -381,6 +383,7 @@ with Setting("pidfile") as s:
s.cli = ["-p", "--pid"]
s.meta = "FILE"
s.validator = validate_string
s.default = None
s.fmt_desc("""\
A filename to use for the PID file.
@ -391,6 +394,7 @@ with Setting("user") as s:
s.section = "Server Mechanics"
s.cli = ["-u", "--user"]
s.validator = validate_string
s.default = None
s.fmt_desc("""\
Switch worker processes to run as this user.
@ -403,6 +407,7 @@ with Setting("group") as s:
s.section = "Server Mechanics"
s.cli = ["-g", "--group"]
s.validator = validate_string
s.default = None
s.fmt_desc("""\
Switch worker process to run as this group.
@ -432,6 +437,7 @@ with Setting("tmp_upload_dir") as s:
s.section = "Server Mechanics"
s.meta = "DIR"
s.validator = validate_string
s.default = None
s.fmt_desc("""\
Directory to store temporary request data as they are read.
@ -524,6 +530,19 @@ with Setting("post_fork") as s:
new Worker.
""")
with Setting("when_ready") as s:
s.section = "Server Hooks"
s.validator = validate_callable(1)
s.type = "callable"
def def_start_server(server):
pass
s.default = def_start_server
s.fmt_desc("""\
Called just after the server is started.
The callable needs to accept a single instance variable for the Arbiter.
""")
with Setting("pre_exec") as s:
s.section = "Server Hooks"
s.validator = validate_callable(1)
@ -537,16 +556,3 @@ with Setting("pre_exec") as s:
The callable needs to accept a single instance variable for the Arbiter.
""")
with Setting("when_ready") as s:
s.section = "Server Hooks"
s.validator = validate_callable(1)
s.type = "callable"
def def_start_server(server):
pass
s.default = def_start_server
s.fmt_desc("""\
Called just after the server is started
The callable needs to accept a single instance variable for the Arbiter.
""")