WebStack

docs/ModPython/NOTES.txt

269:f1a8001208e8
2004-09-19 paulb [project @ 2004-09-19 17:09:22 by paulb] Added session storage notes.
     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 The WebStack package must reside on the PYTHONPATH, along with the package
    18 containing the application itself. Therefore, ensure that the handler uses the
    19 appropriate entries in sys.path.
    20 
    21 Using the above definition in httpd.conf, only server resources residing
    22 directly below "/simple" in the URL "hierarchy" with names ending in ".simple"
    23 would be associated with the Simple WebStack application's resources.
    24 Therefore, the following URL paths would access the application:
    25 
    26   /simple/home.simple
    27   /simple/tasks.simple/my-tasks
    28   /simple/agenda.simple/tomorrow/first-thing
    29 
    30 Examples of URL paths not addressing the application are as follows:
    31 
    32   /agenda/my-agenda.simple
    33   /simple/tasks/my-tasks.simple
    34 
    35 --------
    36 
    37 Authentication/authorisation in mod_python:
    38 
    39 Apache imposes fairly strict controls over authentication, requiring the
    40 addition of various declarations in the configuration in order to impose
    41 access controls on applications, and for WebStack authenticators to be used, a
    42 "PythonAuthenHandler" must be declared in the application's configuration
    43 section.
    44 
    45 Consequently, it is necessary to define authentication methods in the
    46 httpd.conf file as in the following example:
    47 
    48 Alias /auth "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp"
    49 
    50 <Directory "/home/paulb/Software/Python/WebStack/examples/ModPython/AuthApp">
    51     AddHandler python-program .py
    52     PythonHandler AuthHandler
    53     PythonAuthenHandler AuthHandler
    54     PythonDebug On
    55     AuthType Basic
    56     AuthName "AuthResource"
    57     AuthUserFile /usr/local/apache2/conf/users
    58     require valid-user
    59 </Directory>
    60 
    61 The details of the application's deployment, including the exact pathname of
    62 the users file and the appropriate access policy, must obviously be defined
    63 according to the actual application concerned.
    64 
    65 --------
    66 
    67 Session storage with mod_python:
    68 
    69 The very simple SessionStore class provided in WebStack.Helpers.Session, and
    70 used by the WebStack.ModPython.Transaction class, requires that a directory be
    71 created under the Apache server root with the name "WebStack-sessions". Here are
    72 some example commands for doing this:
    73 
    74   cd /usr/local/apache2
    75   mkdir WebStack-sessions
    76   chown username.groupname WebStack-sessions
    77 
    78 The given "username" and "groupname" correspond to the user and group the Apache
    79 server assumes when running.