CGI with python help newbie

Amy G amy-g-art at cox.net
Wed Mar 24 03:10:54 EST 2004


I appreciate the response...

But, when I try something like this...

from mod_python import apache

def handler(req):
    req.content_type = "text/plain"
    req.write("Hello World!")
    return apache.OK

it simply prints the code to the browser when I go to the page.

How do I get the interpreter working from within the browser.
Thanks in advance.


"Amy G" <amy-g-art at cox.net> wrote in message
news:uEa8c.39708$Bg.1320 at fed1read03...
> I have been doing some programming in python for a while now, but have
> always used perl for cgi scripting.  I would like to try using python
> because of its ease of programming.
>
> If I already have apache web server installed and have the python
> interpreter running with no problems.
>
> What is needed to get a python script working over my web server.
>
> For example I have the following:
>
> #!/usr/locla/bin/python
> print "Content-Type: text/plain\n\n"
>
>
> first, middle, last = 5, 7.5, 10
>
> print "first:", first
> print "middle:", middle
> print "last:", last, "\n"
>
>
> I would like it to print out to the browser:
> 5 7.5 10
>
> Any help?
>
> Thanks
>
>





More information about the Python-list mailing list