summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2014-11-24 23:49:52 -0800
committerMarc Abramowitz <marc@marc-abramowitz.com>2014-11-24 23:49:52 -0800
commita7389da748a389acb95e1dcf2780571c75510bf2 (patch)
treeda9f38bdf9af925b4341bcdaa52e2737a61514ea
parent381f7ff08736b1622385a8387f4cb61738c0c850 (diff)
downloadwaitress-a7389da748a389acb95e1dcf2780571c75510bf2.tar.gz
index.rst: Add syntax highlighting
-rw-r--r--docs/index.rst38
1 files changed, 29 insertions, 9 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 6ad771b..b9a58b7 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -10,14 +10,18 @@ It supports HTTP/1.0 and HTTP/1.1.
Usage
-----
-Here's normal usage of the server::
+Here's normal usage of the server:
+
+.. code-block:: python
from waitress import serve
serve(wsgiapp, host='0.0.0.0', port=8080)
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::
+WSGI app as a single argument:
+
+.. code-block:: python
from waitress import serve
serve(wsgiapp)
@@ -26,7 +30,9 @@ Press Ctrl-C (or Ctrl-Break on Windows) to exit the server.
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::
+with the ``unix_socket`` argument:
+
+.. code-block:: python
from waitress import serve
serve(wsgiapp, unix_socket='/path/to/unix.sock')
@@ -37,14 +43,18 @@ Exceptions generated by your application will be shown on the console by
default. See :ref:`logging` to change this.
There's an entry point for :term:`PasteDeploy` (``egg:waitress#main``) that
-lets you use Waitress's WSGI gateway from a configuration file, e.g.::
+lets you use Waitress's WSGI gateway from a configuration file, e.g.:
+
+.. code-block:: ini
[server:main]
use = egg:waitress#main
host = 127.0.0.1
port = 8080
-The :term:`PasteDeploy` syntax for UNIX domain sockets is analagous::
+The :term:`PasteDeploy` syntax for UNIX domain sockets is analagous:
+
+.. code-block:: ini
[server:main]
use = egg:waitress#main
@@ -87,6 +97,8 @@ Within a PasteDeploy configuration file, you can use the normal Python
``logging`` module ``.ini`` file format to change similar Waitress logging
options. For example::
+.. code-block:: ini
+
[logger_waitress]
level = INFO
@@ -136,7 +148,9 @@ application. You can do this in one of three ways:
Using ``url_scheme`` to set ``wsgi.url_scheme``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You can have the Waitress server use the ``https`` url scheme by default.::
+You can have the Waitress server use the ``https`` url scheme by default.:
+
+.. code-block:: python
from waitress import serve
serve(wsgiapp, host='0.0.0.0', port=8080, url_scheme='https')
@@ -169,7 +183,9 @@ Using ``url_prefix`` to influence ``SCRIPT_NAME`` and ``PATH_INFO``
You can have the Waitress server use a particular url prefix by default for all
URLs generated by downstream applications that take ``SCRIPT_NAME`` into
-account.::
+account.:
+
+.. code-block:: python
from waitress import serve
serve(wsgiapp, host='0.0.0.0', port=8080, url_prefix='/foo')
@@ -188,7 +204,9 @@ If only some of the URLs generated by your application should use the
``https`` scheme (and some should use ``http``), you'll need to use Paste's
``PrefixMiddleware`` as well as change some configuration settings on your
proxy. To use ``PrefixMiddleware``, wrap your application before serving it
-using Waitress::
+using Waitress:
+
+.. code-block:: python
from waitress import serve
from paste.deploy.config import PrefixMiddleware
@@ -222,7 +240,9 @@ the ``X-Forwarded-For`` header::
Note that you can wrap your application in the PrefixMiddleware declaratively
in a :term:`PasteDeploy` configuration file too, if your web framework uses
-PasteDeploy-style configuration::
+PasteDeploy-style configuration:
+
+.. code-block:: ini
[app:myapp]
use = egg:mypackage#myapp