[Tutor] Adding python handler to httpd.conf
Wed Jan 15 03:31:33 2003
On Tue, 14 Jan 2003, shobhan wrote:
> I want to add lines which handle python scripts in httpd.conf so that i
> can execute the python script via browser. Can anyone tell what lines
> i've to add to apache conf..??
If you have the CGI module working, then all you probably need to do is
add '.py' as an possible extension name for CGI scripts. Look for the
AddHandler cgi-script cgi pl
and add 'py' to the end of that list. That should do the trick.
All the Python programs should have the magic line '#!/usr/bin/python', so
that when Apache tries to run the CGI, it knows how to execute the Python
You may want to read the official Apache documentation on CGI handling:
which explains more details about running CGI's on Apache. The
documentation uses Perl as their example CGI language, but it applies
equally well to Python.
Good luck to you!