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@77 | 35 | Apache imposes fairly strict controls over authentication, requiring the
|
paulb@77 | 36 | addition of various declarations in the configuration in order to impose
|
paulb@77 | 37 | access controls on applications, and for WebStack authenticators to be used, a
|
paulb@77 | 38 | "PythonAuthenHandler" must be declared in the application's configuration
|
paulb@77 | 39 | section.
|
paulb@51 | 40 |
|
paulb@51 | 41 | Consequently, it is necessary to define authentication methods in the
|
paulb@51 | 42 | httpd.conf file as in the following example:
|
paulb@51 | 43 |
|
paulb@51 | 44 | Alias /auth "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp"
|
paulb@51 | 45 |
|
paulb@51 | 46 | <Directory "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp">
|
paulb@51 | 47 | AddHandler python-program .py
|
paulb@51 | 48 | PythonHandler AuthHandler
|
paulb@77 | 49 | PythonAuthenHandler AuthHandler
|
paulb@51 | 50 | PythonDebug On
|
paulb@51 | 51 | AuthType Basic
|
paulb@51 | 52 | AuthName "AuthResource"
|
paulb@51 | 53 | AuthUserFile /usr/local/apache2/conf/users
|
paulb@51 | 54 | require valid-user
|
paulb@51 | 55 | </Directory>
|
paulb@51 | 56 |
|
paulb@51 | 57 | The details of the application's deployment, including the exact pathname of
|
paulb@51 | 58 | the users file and the appropriate access policy, must obviously be defined
|
paulb@51 | 59 | according to the actual application concerned.
|