[mod_python] Templaing question

Michael Guerrero m at mguerrero.net
Mon Mar 6 14:53:08 EST 2006


On Mon, 2006-03-06 at 13:51 -0500, Jorey Bump wrote:

> Michael Guerrero wrote:
> 
> > Thanks for the config fix Graham.  Also, you said "if you must use 
> > SetHandler...".  I'm only using it because the examples showed it.  Is 
> > it preferable to use AddHandler instead?  Pros/Cons?
> 
> AddHandler results in less conflicts, but limits you to including the 
> extension of filename.py in the URL. I typically enable it for the 
> entire DocumentRoot, just so I can place a published module anywhere 
> (but rarely use this approach).
> 
> SetHandler requires you to commit a directory to serve a special 
> purpose, but offers extra mod_python features and a degree of future 
> proofing. I develop the majority of my applications this way.
> 
> For example, with SetHandler and mod_python.publisher, you can have an 
> URL like this:
> 
>   http://host/dir/foo.py/index
> 
> Where index() is a function in /dir/foo.py. It can also be accessed like 
> this:
> 
>   http://host/dir/foo/
> 
> When your boss realizes that he can replace you with two young PHP 
> programmers for the same price, they can replace your code with:
> 
>   http://host/dir/foo/index.php
> 
> With the proper DirectoryIndex, this is also accessible via:
> 
>   http://host/dir/foo/
> 
> So a lot of links won't need to be updated, no need for mod_rewrite, and 
> you can take a better job at Google with good references, to boot.
> 
> I put my stylesheets in a /css directory in the DocumentRoot, and all of 
> my pages share them, regardless of the language (HTML, Python, PHP, 
> Perl, etc.). Consider using this approach while you learn Publisher. 
> Unlike PHP, where you can deploy an entire application as a 
> self-contained directory, Publisher requires a different approach when 
> using SetHandler. You can hack the conf file to some extent, but it's 
> worth checking out alternate (and sometimes simpler) deployment 
> strategies that might be more portable.
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 


Awesome reply Jorey!  Thanks.

Fortunately for me, my boss on this project is moi since I'm doing this
in my spare time.  Though I was definitely considering replacing me with
two recent college grads versed in PHP just to get it done.

I'm going to take your advice and break things up by dir.  I like that
better than making a directive for each type of file I could possibly
have in a particular directory.

Regards,

Michael C. Guerrero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060306/a4ce044a/attachment.html


More information about the Mod_python mailing list