[mod_python] use publisher without .py file extension

Jorey Bump list at joreybump.com
Thu Oct 12 14:59:30 EDT 2006


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 .conf
> 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