WebStack

docs/ModPython/NOTES.txt

102:e5a71822d501
2004-04-18 paulb [project @ 2004-04-18 23:42:54 by paulb] Added notes, particularly about cookies.
     1 For each application, add an Alias line to httpd.conf to point to the directory
     2 containing the handler package, then specify the appropriate module name as the
     3 PythonHandler.
     4 
     5 Alias /simple "/home/paulb/Software/Python/WebStack/examples/ModPython/SimpleApp"
     6 
     7 <Directory "/home/paulb/Software/Python/WebStack/examples/ModPython/SimpleApp">
     8     AddHandler python-program .simple
     9     PythonHandler SimpleHandler
    10     PythonDebug On
    11 </Directory>
    12 
    13 It would appear that the directory really should be distinct from others
    14 defined for mod_python, and that the handler should have a distinct name from
    15 other handlers employed.
    16 
    17 Using such a definition in httpd.conf, only server resources residing directly
    18 below "/simple" in the URL "hierarchy" with names ending in ".simple" would be
    19 associated with the Simple WebStack application's resources. Therefore, the
    20 following URL paths would access the application:
    21 
    22   /simple/home.simple
    23   /simple/tasks.simple/my-tasks
    24   /simple/agenda.simple/tomorrow/first-thing
    25 
    26 Examples of URL paths not addressing the application are as follows:
    27 
    28   /agenda/my-agenda.simple
    29   /simple/tasks/my-tasks.simple
    30 
    31 --------
    32 
    33 Authentication/authorisation in mod_python:
    34 
    35 Apache imposes fairly strict controls over authentication, requiring the
    36 addition of various declarations in the configuration in order to impose
    37 access controls on applications, and for WebStack authenticators to be used, a
    38 "PythonAuthenHandler" must be declared in the application's configuration
    39 section.
    40 
    41 Consequently, it is necessary to define authentication methods in the
    42 httpd.conf file as in the following example:
    43 
    44 Alias /auth "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp"
    45 
    46 <Directory "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp">
    47     AddHandler python-program .py
    48     PythonHandler AuthHandler
    49     PythonAuthenHandler AuthHandler
    50     PythonDebug On
    51     AuthType Basic
    52     AuthName "AuthResource"
    53     AuthUserFile /usr/local/apache2/conf/users
    54     require valid-user
    55 </Directory>
    56 
    57 The details of the application's deployment, including the exact pathname of
    58 the users file and the appropriate access policy, must obviously be defined
    59 according to the actual application concerned.