Apache web server and CGI

Peter van Kampen news at woody.datatailors.com
Mon Aug 9 11:11:18 EDT 2004


In article <81a41dd.0408090447.7f27a092 at posting.google.com>, Lad wrote:
> How can I set up Apache web server to use Python for CGI processing( for file *.py).
> Thanks for help
> Lad

I will assume you have cgi working in apache in cgi-bin. I will also assume
that you want to use it on *NIX. You didn't tell and I don't know how to do
it on windows ;-) 

The simplest thing that should work is sth like this:

Create a file: test.py

---------------------------------------
#!/usr/bin/env python

print "Content-Type: text/html"
print
print """
<html>
<head>
<title></title>
</head>
<body>
Hello Lad!
</body>
</html>
"""
----------------------------------------

Now do:

chmod 755 test.py

And then go there with a browser:

lynx http:/localhost/cgi-bin/test.py

Hth,

PterK

-- 
Peter van Kampen
pterk -- at -- datatailors.com



More information about the Python-list mailing list