[mod_python] use publisher without .py file extension

Graham Dumpleton grahamd at dscpl.com.au
Thu Oct 12 18:05:19 EDT 2006


This question of how to avoid using extensions with publisher has been answered
recently on the mailing list, plus many times in the past. Although it is more
easily done if SetHandler is used, AddHandler can also be used, it just needs
additional Apache configuration. The ins and outs of SetHandler vs AddHandler
are documented in:

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

This includes an explanation of how to avoid use of an extension when the
AddHandler directive is used.

Rather than repost it again, refer to previous email on mailing list which
includes a full example of Apache configuration to be used for AddHandler.

  http://www.modpython.org/pipermail/mod_python/2006-October/022211.html


Graham

Sells, Fred wrote ..
> 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
> mod_python.
> 
> -----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
> .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.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list