[mod_python] Re: mod_python, debian, apache configuration.

Stephane Bortzmeyer bortzmeyer at nic.fr
Sun Mar 7 22:24:37 EST 2004


On Sun, Mar 07, 2004 at 04:15:37PM -0500,
 donnie <donnie at darthik.com> wrote 
 a message of 75 lines which said:

> I am using the exact mptest.py from the manual:
> 
> from mod_python import apache
> 
> def handler(req):
> 	req.write("Hello World!")
>         return apache.OK
> 
> However, each time I go to http://localhost/darthik/mptest.py it simply
> asks me to save,cancel, or open the file, instead of HelloWorld showing
> up in my browser. 

Before writing "Hello, world", you should send HTTP headers, I believe
(your Apache probably defaults to application/octet-stream):

    req.content_type = "text/html"
    req.send_http_header()


More information about the Mod_python mailing list