blob: 2776e444f472388ecce946b69956d55899cfb640 [file] [log] [blame]
.. _runner:
.. versionadded:: 0.8.4
Waitress comes bundled with a thin command-line wrapper around the ``waitress.serve`` function called ``waitress-serve``.
This is useful for development, and in production situations where serving of static assets is delegated to a reverse proxy, such as nginx or Apache.
``waitress-serve`` takes the very same :ref:`arguments <arguments>` as the
``waitress.serve`` function, but where the function's arguments have
underscores, ``waitress-serve`` uses hyphens. Thus::
import myapp
waitress.serve(myapp.wsgifunc, port=8041, url_scheme='https')
Is equivalent to::
waitress-serve --port=8041 --url-scheme=https myapp:wsgifunc
The full argument list is :ref:`given below <invocation>`.
Boolean arguments are represented by flags. If you wish to explicitly set a
flag, simply use it by its name. Thus the flag::
Is equivalent to passing ``expose_tracebacks=True`` to ``waitress.serve``.
All flags have a negative equivalent. These are prefixed with ``no-``; thus
using the flag::
Is equivalent to passing ``expose_tracebacks=False`` to ``waitress.serve``.
If at any time you want the full argument list, use the ``--help`` flag.
Applications are specified similarly to PasteDeploy, where the format is
``myapp.mymodule:wsgifunc``. As some application frameworks use application
objects, you can use dots to resolve attributes like so:
A number of frameworks, ** being an example, have factory methods on
their application objects that return usable WSGI functions when called. For
cases like these, ``waitress-serve`` has the ``--call`` flag. Thus::
waitress-serve --call
Would load the ``myapp.mymodule`` module, and call ``app.wsgi_factory`` to get
a WSGI application function to be passed to ``waitress.server``.
.. note::
As of 0.8.6, the current directory is automatically included on
.. _invocation:
waitress-serve [OPTS] MODULE:OBJECT
Common options:
Show this information.
Call the given object to get the WSGI application.
Hostname or IP address on which to listen, default is '',
which means "all IP addresses on this host".
TCP port on which to listen, default is '8080'
Tell waitress to listen on an ip port combination.
This option may be used multiple times to listen on multipe sockets.
A wildcard for the hostname is also supported and will bind to both
IPv4/IPv6 depending on whether they are enabled or disabled.
Toggle on/off IPv4 support.
This affects wildcard matching when listening on a wildcard address/port
Toggle on/off IPv6 support.
This affects wildcard matching when listening on a wildcard address/port
Path of Unix socket. If a socket path is specified, a Unix domain
socket is made instead of the usual inet domain socket.
Not available on Windows.
Octal permissions to use for the Unix domain socket, default is
Default ``wsgi.url_scheme`` value, default is 'http'.
The ``SCRIPT_NAME`` WSGI environment value. Setting this to anything
except the empty string will cause the WSGI ``SCRIPT_NAME`` value to be the
value passed minus any trailing slashes you add, and it will cause the
``PATH_INFO`` of any request which is prefixed with this value to be
stripped of the prefix. Default is the empty string.
Server identity used in the 'Server' header in responses. Default
is 'waitress'.
Tuning options:
Number of threads used to process application logic, default is 4.
Connection backlog for the server. Default is 1024.
Number of bytes to request when calling ``socket.recv()``. Default is
Number of bytes to send to socket.send(). Default is 1.
Multiples of 9000 should avoid partly-filled TCP packets.
.. deprecated:: 1.3
A temporary file should be created if the pending output is larger than
this. Default is 1048576 (1MB).
The app_iter will pause when pending output is larger than this value
and will resume once enough data is written to the socket to fall below
this threshold. Default is 16777216 (16MB).
A temporary file should be created if the pending input is larger than
this. Default is 524288 (512KB).
Stop creating new channels if too many are already active. Default is
Minimum seconds between cleaning up inactive channels. Default is 30. See
Maximum number of seconds to leave inactive connections open. Default is
120. 'Inactive' is defined as 'has received no data from the client and has
sent no data to the client'.
Toggle whether premature client disconnect tracebacks ought to be logged.
On by default.
Maximum size of all request headers combined. Default is 262144 (256KB).
Maximum size of request body. Default is 1073741824 (1GB).
Toggle whether to expose tracebacks of unhandled exceptions to the client.
Off by default.
The timeout value in seconds passed to ``asyncore.loop()``. Default is 1.
The use_poll argument passed to ``asyncore.loop()``. Helps overcome open
file descriptors limit. Default is False.