| | 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 | |
|---|