[mod_python] CGI versus *real* mod_python?

John Mudd mudd at vex.net
Mon Apr 12 00:39:15 EST 2004


So this is CGI?  I'm afraid this is what I've been doing too. 

    from mod_python import apache
    def handler(req):
        req.write("Hello World!")
        return apache.OK



I switched my Apache httpd.conf file as you suggested and now I can do
this.  

    def hello(req):
        return 'Hello world!'

This example is much simpler.  But the couple of extra lines of code
doesn't make much difference in my full application.  Are there other
benefits to this approach that aren't so obvious?

    

On Sat, 2004-04-10 at 20:33, Jorey Bump wrote:
> John Draper wrote:
> 
> >  >4.    Edit mptest.py file in the htdocs/test directory so that is has 
> > the following lines (be careful when cutting and >pasting from your 
> > browser, you may end up with incorrect indentation and a syntax error):
> > 
> >  >    from mod_python import apache
> > 
> >  >    def handler(req):
> >  >        req.write("Hello World!")
> >  >        return apache.OK
> > 
> > Ok - I've done that,  and saved it into cgi-bin/test directory.
> 
> Don't do that, it's not CGI.
> 




More information about the Mod_python mailing list