Simple discussion of python cgi approaches?

Kylotan kylotan at hotmail.com
Tue Apr 13 22:57:55 EDT 2004


Steve Holden <python at holdenweb.com> wrote in message news:<UZSec.630$2e6.71 at lakeread01>...
> Kylotan wrote:
> 
> > I'm particularly confused by a few people advocating things like
> > Xitami + LRWP for being very simple, yet it can't possibly be simpler
> > than just dropping a cgi script into a directory, as I do with Apache,
> > and the docs on LRWP
> > (http://www.imatix.com/html/xitami/index12.htm#TOC114) make it look
> > like I'd have to do significant rewriting of the scripts. It describes
> > itself as being like FastCGI which, if true, doesn't exactly endear
> > FastCGI to me either.
> > 
> Well, you said you are looking for "alternatives or optimaizations", so 
> it would appear that you feel you are approaching the limits of your 
> simple approach. It's a very unsual solution that will be simpler, 
> faster and cheaper than the "obvious" one, though such solutions aren't 
> unheard of, even in the web world.

I know. I guess I am just spoiled by the simplicity of using things
like Psyco
that I sometimes forget that not everything comes for free!

> mod_python [...]
> 
> The intergration is very tight, and you can write Apache handlers of all 
> kinds in Python. I have experimented myself with writing request 
> handlers, with results briefly reported at PyCON this year. It's a good 
> general-purpose approach for uni-processor solutions.

Yet I'm guessing it requires a significant amount of special-case code
to
use its own API? Looking at the manual it seems non-trivial to get it
to work with scripts that were originally written to consume stdin and
emit to stdout.

> Clearly anything that has performance benefits over CGI is likely to be 
> a little more difficult to get running but believe me, the extra effort 
> isn't that great when you consider the rewards.

The main problem I face is that I don't know what platform my scripts
will
eventually run on. I may not have the ability to install extra
software so I
need to keep my scripts close to the CGI standard. That is, one file
per script,
using the cgi module for form processing and print for output. I don't
mind
having to redirect stdout or call these scripts indirectly instead of
via
their __main__ functions, but writing to specific APIs (beyond a small
wrapper
layer, of course) is not an option at the moment.

So I'm hoping for simple solutions that will involve no more than a
few changes
to each script, whereas most of the solutions that seem to be
available require
me to use their own request objects, or to treat pages as callable
functions within an overall page as mod_python seems to require.

-- 
Ben Sizer



More information about the Python-list mailing list