Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
fgallaire committed Aug 10, 2016
1 parent e085c76 commit 29a37c4
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 26 deletions.
72 changes: 72 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
WSGIserver
==========

**WSGIserver** is a high-speed, production ready, thread pooled, generic WSGI server with **SSL support**.

WSGIserver suppport both Python 2 and Python 3.

WSGIserver is developed by Florent Gallaire [email protected].

Website: http://fgallaire.github.io/wsgiserver.

Download and Install
--------------------

To install the last stable version from PyPI::

$ sudo pip install wsgiserver

To install the development version from GitHub::

$ git clone https://github.com/fgallaire/wsgiserver
$ cd wsgi
$ sudo python setup.py install

Documentation and Caveats
-------------------------

- WSGIserver support Python 2.6 and above and Python 3.1 and above

- WSGIserver require six

Usage
-----

Simplest example on how to use WSGIserver::

import wsgiserver

def my_app(environ, start_response):
status = '200 OK'
response_headers = [('Content-type','text/plain')]
start_response(status, response_headers)
return ['WSGIserver is running!']

server = wsgiserver.WSGIServer(('0.0.0.0', 8070), my_app)
server.start()

WSGIserver can serve as many WSGI applications as you want in one
instance by using a ``WSGIPathInfoDispatcher``::

d = wsgiserver.WSGIPathInfoDispatcher({'/': my_app, '/blog': my_blog_app})
server = wsgiserver.WSGIServer(('0.0.0.0', 80), d)

To add SSL support, just set ``server.ssl_adapter`` to an ``SSLAdapter`` instance::

server.ssl_adapter = wsgiserver.SSLAdapter('certificate.pem', 'privatekey.pem')

Naming
------

- *WSGIserver* is the project name

- *wsgiserver* is the Python module name

- *WSGIServer* is the main class name

License
-------

WSGIserver files are released under the GNU AGPLv3 or above license.

WSGIserver codebase from CherryPy by CherryPy Team ([email protected]) under the 3-clause BSD license.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup
from wsgiserver import __version__ as version

setup(name='WSGIServer',
setup(name='WSGIserver',
version=version,
description='A high-speed, production ready, thread pooled, generic WSGI server',
author='Florent Gallaire',
Expand Down
27 changes: 2 additions & 25 deletions wsgiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,6 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Simplest example on how to use WSGIServer::
import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('Content-type','text/plain')]
start_response(status, response_headers)
return ['Hello world!']
server = wsgiserver.WSGIServer(
('0.0.0.0', 8070), my_crazy_app,
server_name='www.wsgiserver.example')
server.start()
WSGIServer can serve as many WSGI applications as you want in one
instance by using a WSGIPathInfoDispatcher::
d = WSGIPathInfoDispatcher({'/': my_crazy_app, '/blog': my_blog_app})
server = wsgiserver.WSGIServer(('0.0.0.0', 80), d)
Want SSL support? Just set server.ssl_adapter to an SSLAdapter instance.
For those of you wanting to understand internals of this module, here's the
basic call flow. The server's listening thread runs a very tight loop,
sticking incoming connections onto a Queue::
Expand Down Expand Up @@ -1887,7 +1864,7 @@ class HTTPServer(object):
timeout = 10
"""The timeout in seconds for accepted connections (default 10)."""

version = "WSGIServer/" + __version__
version = "WSGIserver/" + __version__
"""A version string for the HTTPServer."""

software = None
Expand Down Expand Up @@ -1959,7 +1936,7 @@ def clear_stats(self):
for w in s['Worker Threads'].values()], 0),
'Worker Threads': {},
}
logging.statistics["WSGIServer %d" % id(self)] = self.stats
logging.statistics["WSGIserver %d" % id(self)] = self.stats

def runtime(self):
if self._start_time is None:
Expand Down

0 comments on commit 29a37c4

Please sign in to comment.