[mod_python] use publisher without .py file extension

Sells, Fred fred at adventistcare.org
Thu Oct 12 16:05:47 EDT 2006

I tried that and got a "module not found",  could you send me a copy of your
<Directory... from the .conf file.  Perhaps I just had a brain fart.  I like
the approach you describe; that's what we did with cgi before changing to

-----Original Message-----
From: Jorey Bump [mailto:list at joreybump.com]
Sent: Thursday, October 12, 2006 3:00 PM
To: Sells, Fred
Cc: mod_python at modpython.org
Subject: Re: [mod_python] use publisher without .py file extension

Sells, Fred wrote:
> I would like to be able to use the mod_python.publisher without requiring
> using the .py suffix in my file.  The idea is to not disclose to the user
> that python is being used as one more bit of security.
> I tried it but it seems as if the mod_python import is expecting standard
> python modules.
> While I would like a generic solution, each "application" is in it's own
> subdirectory and would have very few (hopefully 1) file that is the single
> point of access to all backend logic.  Thus I could revise the apache
> file whenever a new application is added if I must.

This isn't necessary. I create a single directory for the frontends, 
then use SetHandler to configure apache to use Publisher for everything 
in that directory. The .py extension is no longer needed. The frontends 
are minimal, serving as gateways to the backend logic, as you describe. 
The only caveat is that the directory must contain only python modules, 
with other resources placed elsewhere. This can be a benefit, if you 
like keeping your code separate from images, stylesheets, etc. But there 
also ways around this limitation, using a more complex configuration.

I used to "register" publisher applications in the conf file, as you 
describe, but found it to be a burden. It's much nicer to just have a 
directory to drop files into.

More information about the Mod_python mailing list