1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
Introduction
============
circuits.web is a set of components for building high performance HTTP/1.1
and WSGI/1.0 compliant web applications. These components make it easy to
rapidly develop rich, scalable web applications with minimal effort.
circuits.web borrows from
* `CherryPy <http://www.cherrypy.org>`_
* BaseHTTPServer (*Python std. lib*)
* wsgiref (*Python std. lib*)
Overview
--------
The ``circuits.web`` namespace contains the following exported components
and events for convenience:
Events
~~~~~~
+---------------+-----------------------------------+
| Event | Description |
+===============+===================================+
| Request | The Request Event |
+---------------+-----------------------------------+
| Response | The Response Event |
+---------------+-----------------------------------+
| Stream | The Stream Event |
+---------------+-----------------------------------+
Servers
~~~~~~~
+---------------+-----------------------------------+
| Server | Description |
+===============+===================================+
| BaseServer | The Base Server (no Dispatcher) |
+---------------+-----------------------------------+
| Server | The **full** Server + Dispatcher |
+---------------+-----------------------------------+
Error Events
~~~~~~~~~~~~
+---------------+-----------------------------------+
| Error | Description |
+===============+===================================+
| HTTPError | A generic HTTP Error Event |
+---------------+-----------------------------------+
| Forbidden | A Forbidden (403) Event |
+---------------+-----------------------------------+
| NotFound | A Not Found (404) Event |
+---------------+-----------------------------------+
| Redirect | A Redirect (30x) Event |
+---------------+-----------------------------------+
Dispatchers
~~~~~~~~~~~
+---------------+-----------------------------------+
| Dispatcher | Description |
+===============+===================================+
| Static | A Static File Dispatcher |
+---------------+-----------------------------------+
| Dispatcher | The Default Dispatcher |
+---------------+-----------------------------------+
| VirtualHosts | Virtual Hosts Dispatcher |
+---------------+-----------------------------------+
| XMLRPC | XML-RPC Dispatcher |
+---------------+-----------------------------------+
| JSONRPC | JSON-RPC Dispatcher |
+---------------+-----------------------------------+
Other Components
~~~~~~~~~~~~~~~~
+---------------+-----------------------------------+
| Component | Description |
+===============+===================================+
| Logger | Default Logger |
+---------------+-----------------------------------+
| Controller | Request Handler Mapper |
+---------------+-----------------------------------+
| Sessions | Default Sessions Handler |
+---------------+-----------------------------------+
To start working with circuits.web one normally only needs to import
from circuits.web, for example:
.. code-block:: python
:linenos:
from circuits import Component
from circuits.web import BaseServer
class Root(Component):
def request(self, request, response):
return "Hello World!"
(BaseServer(8000) + Root()).run()
For further information regarding any of circuits.web's components,
events or other modules and functions refer to the API Documentation.
|