paulb@19 | 1 | For each application, add an Alias line to httpd.conf to point to the directory
|
paulb@20 | 2 | containing the handler package, then specify the appropriate module name as the
|
paulb@19 | 3 | PythonHandler.
|
paulb@19 | 4 |
|
paulb@40 | 5 | Alias /simple "/home/paulb/Software/Python/WebStack/examples/ModPython/SimpleApp"
|
paulb@19 | 6 |
|
paulb@40 | 7 | <Directory "/home/paulb/Software/Python/WebStack/examples/ModPython/SimpleApp">
|
paulb@20 | 8 | AddHandler python-program .simple
|
paulb@20 | 9 | PythonHandler SimpleHandler
|
paulb@19 | 10 | PythonDebug On
|
paulb@19 | 11 | </Directory>
|
paulb@19 | 12 |
|
paulb@20 | 13 | It would appear that the directory really should be distinct from others
|
paulb@20 | 14 | defined for mod_python, and that the handler should have a distinct name from
|
paulb@20 | 15 | other handlers employed.
|
paulb@34 | 16 |
|
paulb@34 | 17 | Using such a definition in httpd.conf, only server resources residing directly
|
paulb@34 | 18 | below "/simple" in the URL "hierarchy" with names ending in ".simple" would be
|
paulb@34 | 19 | associated with the Simple WebStack application's resources. Therefore, the
|
paulb@34 | 20 | following URL paths would access the application:
|
paulb@34 | 21 |
|
paulb@34 | 22 | /simple/home.simple
|
paulb@34 | 23 | /simple/tasks.simple/my-tasks
|
paulb@34 | 24 | /simple/agenda.simple/tomorrow/first-thing
|
paulb@34 | 25 |
|
paulb@34 | 26 | Examples of URL paths not addressing the application are as follows:
|
paulb@34 | 27 |
|
paulb@34 | 28 | /agenda/my-agenda.simple
|
paulb@34 | 29 | /simple/tasks/my-tasks.simple
|
paulb@51 | 30 |
|
paulb@51 | 31 | --------
|
paulb@51 | 32 |
|
paulb@51 | 33 | Authentication/authorisation in mod_python:
|
paulb@51 | 34 |
|
paulb@51 | 35 | Whilst WebStack applications are permitted to send the "WWW-Authenticate"
|
paulb@51 | 36 | header to HTTP clients, Apache appears to avoid defining the current user
|
paulb@51 | 37 | unless various Auth directives have been applied to such applications in the
|
paulb@51 | 38 | httpd.conf file, and since Apache sends such authentication headers when such
|
paulb@51 | 39 | directives have been applied in the configuration, WebStack applications seem
|
paulb@51 | 40 | to have limited control over the precise circumstances of authentication
|
paulb@51 | 41 | itself.
|
paulb@51 | 42 |
|
paulb@51 | 43 | Consequently, it is necessary to define authentication methods in the
|
paulb@51 | 44 | httpd.conf file as in the following example:
|
paulb@51 | 45 |
|
paulb@51 | 46 | Alias /auth "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp"
|
paulb@51 | 47 |
|
paulb@51 | 48 | <Directory "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp">
|
paulb@51 | 49 | AddHandler python-program .py
|
paulb@51 | 50 | PythonHandler AuthHandler
|
paulb@51 | 51 | PythonDebug On
|
paulb@51 | 52 | AuthType Basic
|
paulb@51 | 53 | AuthName "AuthResource"
|
paulb@51 | 54 | AuthUserFile /usr/local/apache2/conf/users
|
paulb@51 | 55 | require valid-user
|
paulb@51 | 56 | </Directory>
|
paulb@51 | 57 |
|
paulb@51 | 58 | The details of the application's deployment, including the exact pathname of
|
paulb@51 | 59 | the users file and the appropriate access policy, must obviously be defined
|
paulb@51 | 60 | according to the actual application concerned.
|