[mod_python] eliminating last foo.py from url?

Mark Harrison mh at pixar.com
Mon Dec 18 19:28:40 EST 2006


Graham Dumpleton wrote:
> Since you are setting the PythonPath directive to where your module file is
> potentially installed anyway, you are possibly just better of using:
> 
>   # Move your stuff out of the document tree and you will not need this.
> 
>   <Directory "/Users/mh/mp/htdocs/xmlrpc/x1">
>      deny from all
>   </Directory>
> 
>   # Use Location instead of Directory.
> 
>   <Location /x1>
>      # The PythonPath may have to be adjusted.
>      PythonPath "sys.path+['/Users/mh/mp/htdocs/xmlrpc','/Users/mh/mp/htdocs/xmlrpc/x1']"
>      SetHandler mod_python
>      PythonHandler x1
>   </Location>
> 
> By using Location directive, and with location itself not having trailing slash,
> Apache will not do trailing slash redirection and just pass any request starting
> with /x1 through to your handler.

Ah, <Location> looks preferable to <Directory>, since then I don't have to install
the python files under htdocs, but can instead point them to our build tree.

But it's strange, even <Location> requires a trailing slash.  If I have too
hard of a time getting clients to include it then I'll add the Alias.

BTW, apache+mod_python seems to be a nice xmlrpc platform.
When I get this polished, I'll try and get permission to put a note on the
wiki about setting it up.

Many Thanks!
Mark

-- 
Mark Harrison
Pixar Animation Studios


More information about the Mod_python mailing list