paulb@671 | 1 | The WSGI examples provide support for the wsgiref.simple_server module
|
paulb@671 | 2 | (available in Python 2.5 and later) and the WSGI CGI handler code found in PEP
|
paulb@671 | 3 | 333 and placed in the wsgi_cgi module. Deploying in other environments would
|
paulb@307 | 4 | require slightly different "glue code" to be written.
|
paulb@302 | 5 |
|
paulb@671 | 6 | Deploying with wsgiref.simple_server
|
paulb@671 | 7 | ====================================
|
paulb@671 | 8 |
|
paulb@671 | 9 | The examples/WSGI/*App.py programs (eg. examples/WSGI/SimpleApp.py) can be run
|
paulb@671 | 10 | directly - these will employ the WSGI server in the Python standard library.
|
paulb@671 | 11 |
|
paulb@671 | 12 | Deploying in CGI Environments
|
paulb@671 | 13 | =============================
|
paulb@307 | 14 |
|
paulb@307 | 15 | Declare the script in httpd.conf or equivalent Web server configuration file.
|
paulb@307 | 16 | For example:
|
paulb@307 | 17 |
|
paulb@307 | 18 | ScriptAlias /wsgi/simple "/home/paulb/Software/Python/WebStack/examples/WSGI/SimpleHandler.py"
|
paulb@302 | 19 |
|
paulb@302 | 20 | The WebStack package must reside on the PYTHONPATH, along with the package
|
paulb@307 | 21 | containing the application itself. Therefore, ensure that the handler uses the
|
paulb@307 | 22 | appropriate entries in sys.path.
|
paulb@302 | 23 |
|
paulb@307 | 24 | Ensure that the handler file for the application has the appropriate
|
paulb@307 | 25 | permissions:
|
paulb@307 | 26 |
|
paulb@307 | 27 | chmod u+x examples/WSGI/SimpleHandler.py
|