Python with Apache on WinNT newbie question

Gerhard Häring gerhard.nospam at bigfoot.de
Thu Dec 28 14:21:34 EST 2000


I recommend to add the following line to httpd.conf under WinNT:

ScriptInterpreterSource Registry

and give your Python scripts the extension ".py". A Python CGI script can
then look like:

#!/usr/bin/env python
print 'Content-type: text/plain\n\nHello!'

and work perfectly under WinNT and Linux!

Gerhard Häring
-- 
mail:   gerhard <at> bigfoot <dot> de
web:    http://highqualdev.com

On Thu, 28 Dec 2000 16:07:07 GMT, Victor Muslin <victor at prodigy.net> wrote:
>To get Apache server to run a Python CGI script, the script needs to
>have on its first line a directive telling Apache the file name of the
>Python interpreter, like so:
>
>	#!d:/apps/python/python.exe
>	#
>	# The rest of my cgi script follows
>	# ....
>
>The problem with this is deploying this script on different machines
>that may have Python interpreter installed in different directories.
>Surely others had run into the same issue. What is a typical solution?
>Unfortunately, if this directive can take environmental variables I
>could not figure out how to do it.



More information about the Python-list mailing list