New in version 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 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 given below.
Boolean arguments are represented by flags. If you wish to explicitly set a flag, simply use it by its name. Thus the flag:
--expose-tracebacks
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:
--no-expose-tracebacks
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: myapp.mymodule:appobj.wsgifunc.
A number of frameworks, web.py 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 myapp.mymodule.app.wsgi_factory
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 sys.path.
Usage:
waitress-serve [OPTS] MODULE:OBJECT
Common options:
Tell waitress to listen on an ip port combination.
Example:
–listen=127.0.0.1:8080 –listen=[::1]:8080 –listen=*:8080
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 combination.
Toggle on/off IPv6 support.
This affects wildcard matching when listening on a wildcard address/port combination.
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.
Tuning options:
Number of bytes to send to socket.send(). Default is 1. Multiples of 9000 should avoid partly-filled TCP packets.
Deprecated since version 1.3.