diff options
author | Steve Piercy <web@stevepiercy.com> | 2018-09-22 14:49:40 -0700 |
---|---|---|
committer | Steve Piercy <web@stevepiercy.com> | 2018-09-22 14:49:40 -0700 |
commit | 88248b8b4348dd55696ed62000076611e835af89 (patch) | |
tree | 1ab33dff7b254e0fa43e2defcc235a655685dcdd /docs | |
parent | 6e35183f44dafdaeda884c831d4e6295545ab2f3 (diff) | |
download | waitress-88248b8b4348dd55696ed62000076611e835af89.tar.gz |
Make text align with its code.
Use consistent code-block indentation.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/usage.rst | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/docs/usage.rst b/docs/usage.rst index 3ef17e2..5d3309b 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -4,50 +4,36 @@ Usage ===== -Here's normal usage of the server: +The following code will run waitress on port 8080 on all available IP addresses, both IPv4 and IPv6. .. code-block:: python - from waitress import serve - serve(wsgiapp, listen='*:8080') + from waitress import serve + serve(wsgiapp, listen='*:8080') -This will run waitress on port 8080 on all available IP addresses, both IPv4 -and IPv6. +Press :kbd:`Ctrl-C` (or :kbd:`Ctrl-Break` on Windows) to exit the server. +The following will run waitress on port 8080 on all available IPv4 addresses, but not IPv6. .. code-block:: python - from waitress import serve - serve(wsgiapp, host='0.0.0.0', port=8080) + from waitress import serve + serve(wsgiapp, host='0.0.0.0', port=8080) -This will run waitress on port 8080 on all available IPv4 addresses. - -If you want to serve your application on all IP addresses, on port 8080, you -can omit the ``host`` and ``port`` arguments and just call ``serve`` with the -WSGI app as a single argument: - -.. code-block:: python - - from waitress import serve - serve(wsgiapp) - -Press Ctrl-C (or Ctrl-Break on Windows) to exit the server. - -The default is to bind to any IPv4 address on port 8080: +By default Waitress binds to any IPv4 address on port 8080. +You can omit the ``host`` and ``port`` arguments and just call ``serve`` with the WSGI app as a single argument: .. code-block:: python - from waitress import serve - serve(wsgiapp) + from waitress import serve + serve(wsgiapp) -If you want to serve your application through a UNIX domain socket (to serve -a downstream HTTP server/proxy, e.g., nginx, lighttpd, etc.), call ``serve`` -with the ``unix_socket`` argument: +If you want to serve your application through a UNIX domain socket (to serve a downstream HTTP server/proxy such as nginx, lighttpd, and so on), call ``serve`` with the ``unix_socket`` argument: .. code-block:: python - from waitress import serve - serve(wsgiapp, unix_socket='/path/to/unix.sock') + from waitress import serve + serve(wsgiapp, unix_socket='/path/to/unix.sock') Needless to say, this configuration won't work on Windows. @@ -59,25 +45,25 @@ lets you use Waitress's WSGI gateway from a configuration file, e.g.: .. code-block:: ini - [server:main] - use = egg:waitress#main - listen = 127.0.0.1:8080 + [server:main] + use = egg:waitress#main + listen = 127.0.0.1:8080 Using ``host`` and ``port`` is also supported: .. code-block:: ini - [server:main] - host = 127.0.0.1 - port = 8080 + [server:main] + host = 127.0.0.1 + port = 8080 The :term:`PasteDeploy` syntax for UNIX domain sockets is analagous: .. code-block:: ini - [server:main] - use = egg:waitress#main - unix_socket = /path/to/unix.sock + [server:main] + use = egg:waitress#main + unix_socket = /path/to/unix.sock You can find more settings to tweak (arguments to ``waitress.serve`` or equivalent settings in PasteDeploy) in :ref:`arguments`. @@ -88,10 +74,10 @@ can be used in development and in situations where the likes of .. code-block:: bash - # Listen on both IPv4 and IPv6 on port 8041 - waitress-serve --listen=*:8041 myapp:wsgifunc + # Listen on both IPv4 and IPv6 on port 8041 + waitress-serve --listen=*:8041 myapp:wsgifunc - # Listen on only IPv4 on port 8041 - waitress-serve --port=8041 myapp:wsgifunc + # Listen on only IPv4 on port 8041 + waitress-serve --port=8041 myapp:wsgifunc For more information on this, see :ref:`runner`. |