Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1537

Show
Ignore:
Timestamp:
12/20/06 15:28:55
Author:
lawouach
Message:

Added a very simple example of this module

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/wsgiserver.py

    r1530 r1537  
     1 
     2######################################################################### 
     3# 
     4# # Simplest example on how to use this module directly 
     5# # Without going through the CherryPy machinery 
     6#  
     7# from cherrypy import wsgiserver 
     8# 
     9# def my_crazy_app(environ, start_response): 
     10#     status = '200 OK' 
     11#     response_headers = [('Content-type','text/plain')] 
     12#     start_response(status, response_headers) 
     13#     return ['Hello world!\n'] 
     14# 
     15# # The CherryPy WSGI server can serve as many WSGI application 
     16# # as you want in one instance 
     17# 
     18# # Her we set our application to the script_name '/'  
     19# wsgi_apps = [('/', my_crazy_app)] 
     20# 
     21# # This won't call CherryPy machinery at all 
     22# # Only the WSGI server which is independant from CherryPy itself 
     23# # Its name reflects its origin... 
     24# server = wsgiserver.CherryPyWSGIServer(('localhost', 8070),  
     25#                                        wsgi_apps, server_name='localhost') 
     26# 
     27# # Want SSL support? Just set those attributes 
     28# # server.ssl_certificate = ... 
     29# # server.ssl_private_key = ... 
     30# 
     31# if __name__ == '__main__': 
     32#     server.start() 
     33######################################################################### 
     34 
    135"""A high-speed, production ready, thread pooled, generic WSGI server.""" 
    236 
     
    5185class HTTPRequest(object): 
    5286     
     87 
    5388    def __init__(self, connection): 
    5489        self.connection = connection 

Hosted by WebFaction

Log in as guest/cpguest to create tickets