Newbie: How do you enable python scripts in apache server?

kuntzagk at sulawesi.bioinf.mdc-berlin.de kuntzagk at sulawesi.bioinf.mdc-berlin.de
Thu Jun 5 11:40:51 EDT 2003


On Thu, 05 Jun 2003 17:16:22 +0200, Husam wrote:

> Hi,
> I have apache server running on redhat 9 and wants to run python scripts
> with it. I made a test script test.py and chmod to 777. The script sits
> in the root directory of the www-site. The script is this:
> 
> #!/usr/bin/python
> print "Content-Type: text/plain\n\n"
> print "Hello, Python!"
> 
> Although the script executes properly in konsole terminal, the problem
> is when I try to execute this script in netscape like this:
> http://localhost/test.py

This seems not so much a python issue then a apache-configuration issue.
You should put your script in a cgi directory or enable CGI-execution for
the scripts directory ala:

ScriptAlias /url_for_scriptdir "/scriptdir"

Murple




More information about the Python-list mailing list