Module Expr Str ImportFrom alias Import alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr keyword ListLoad Str keyword AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Return Call NameLoad NameLoad NameLoad decorator_list decorator_list
N/A N/A This is the most important :ref:`pulsar application <application-api>`.
The server is a specialized :ref:`socket server <apps-socket>`
for web applications conforming with the python web server
gateway interface (`WSGI 1.0.1`_).
The server can be used in conjunction with several web frameworks
as well as :ref:`pulsar wsgi application handlers <wsgi-handlers>`,
:ref:`pulsar router <wsgi-middleware>`,
the :ref:`pulsar RPC middleware <apps-rpc>` and
the :ref:`websocket middleware <apps-ws>`.

.. note::

    Pulsar wsgi server is production ready designed to easily
    handle fast, scalable http applications. As all pulsar applications,
    it uses an event-driven, non-blocking I/O model that makes it
    lightweight and efficient. In addition, its multiprocessing
    capabilities allow to handle the `c10k problem`_ with ease.


An example of a web server written with the :mod:`~pulsar.apps.wsgi`
module which responds with ``Hello World!`` for every request::

    from pulsar.apps import wsgi

    def hello(environ, start_response):
        data = b"Hello World!"
        response_headers = [('Content-type','text/plain'),
                            ('Content-Length', str(len(data)))]
        start_response("200 OK", response_headers)
        return [data]

    if __name__ == '__main__':
        wsgi.WSGIServer(hello).start()


For more information regarding WSGI check the pep3333_ specification.
To run the application::

    python script.py

For available run options::

    python script.py --help



WSGI Server
===================

.. autoclass:: WSGIServer
   :members:
   :member-order: bysource


.. _`WSGI 1.0.1`: http://www.python.org/dev/peps/pep-3333/
.. _`c10k problem`: http://en.wikipedia.org/wiki/C10k_problem
 functools partial N/A pulsar pulsar.apps.socket SocketServer Connection html * content * utils * middleware * response * wrappers * server * route * handlers * routers * auth * formdata * WSGIServer N/A SocketServer N/A N/A A WSGI :class:`.SocketServer`.
     N/A name wsgi N/A cfg N/A N/A pulsar Config apps N/A socket server_software N/A pulsar SERVER_SOFTWARE protocol_factory N/A N/A self N/A N/A N/A cfg N/A self cfg N/A consumer_factory N/A partial HttpServerResponse N/A cfg callable cfg N/A cfg server_software N/A N/A partial Connection consumer_factory N/A N/A