[mod_python] apache configuration

Graham Dumpleton graham.dumpleton at gmail.com
Sun Aug 26 17:56:32 EDT 2007


On 27/08/07, Francis West <francis.west at ntlworld.com> wrote:
> Hello,
>     i just picked up mod_python today,  I wanted to build a system where
> I could handle all requests under a certain director.  for example:
>
> my apache config looks something like this:
>
>     Alias /learning/ "/script/home/learning/"
>     <Directory "/script/home/learning/">
>
>         DirectoryIndex index.py
>
>         Options Indexes MultiViews FollowSymLinks
>         AddHandler mod_python .py
>         PythonHandler index
>         PythonDebug On
>
>     </Directory>
>
>
> what i would like to do next is have all requests to
> /learning/xxx.anything get processed by the index.py

If you use SetHandler rather than AddHandler, it will process all
requests in the scope through mod_python.

   <Directory "/script/home/learning/">

       SetHandler mod_python .py
       PythonHandler index
       PythonDebug On

   </Directory>

I'm not quite sure if that is what you meant though as when you say
'xxx.anything', do you mean just for the resource with that name, or
are you implying some wildcarding, or as above, anything in the
directory. If just that resource:

   <Directory "/script/home/learning/">

       DirectoryIndex index.py

       Options Indexes MultiViews FollowSymLinks
       AddHandler mod_python .py
       PythonHandler index
       PythonDebug On

       <Files xxx.anything>
       SetHandler mod_python
       </Files>

   </Directory>

Can you provide a better example of what you want? Perhaps also
expressing it in terms of the final goal as opposed to a specific step
along the way.

Also read:

  http://www.dscpl.com.au/wiki/ModPython/Articles/SetHandlerVersusAddHandler

Graham


More information about the Mod_python mailing list