[Tutor] Simple CGI script and Apache configuration

wormwood_3 wormwood_3 at yahoo.com
Tue Feb 24 13:28:41 CET 2009


I wasn't sure if that was needed, so I took it out, sorry about that. I put 

ScriptAlias /cgi-bin/ "/var/www/samuelhuckins.com/cgi-bin/"
 
in place, reloaded, and it works! I think the problem throughout was that I was mixing up what was necessary between CGI and mod_python. 

If you'd like a random programming epigram served up by this new config, check out: http://samuelhuckins.com/cgi-bin/qotd.py 

-Sam

 _______________________
Samuel Huckins


Homepage - http://samuelhuckins.com
Tech blog - http://dancingpenguinsoflight.com/
Photos - http://www.flickr.com/photos/samuelhuckins/
AIM - samushack | Gtalk - samushack | Skype - shuckins




________________________________
From: Martin Walsh <mwalsh at mwalsh.org>
To: wormwood_3 <wormwood_3 at yahoo.com>
Cc: Python Tutorlist <tutor at python.org>
Sent: Tuesday, February 24, 2009 2:32:48 AM
Subject: Re: [Tutor] Simple CGI script and Apache configuration

wormwood_3 wrote:
> Thanks for all the suggestions! I tried to go through them, and will
> relate what results I encountered. I changed my Apache config to:
> 
>          <Directory /var/www/samuelhuckins.com/cgi-bin/>
>                  AllowOverride None
>                  Options ExecCGI
>                  Order allow,deny
>                  Allow from all
>          </Directory>
> 
> I in fact did not have the cgi module enabled, so I did that. Then I ran
> "sudo /etc/init.d/apache2 reload", and hit
> http://samuelhuckins.com/cgi-bin/hello.py, which contains simply:
> 
> #!/usr/bin/python
> print "Content-type: text/html"
> print
> print "<html>"
> print "<center>Hello!</center>"
> print "</html>"
> 
> I get prompted to download the file, but it does not execute or appear
> in plain text. The logs just show the request being made. What is the
> missing element to get this script to execute?
> 

When you look at the downloaded file, is it your python script?

Looks like you changed the path where you're keeping your cgi script,
did you update the ScriptAlias directive to suit?

You may find this more helpful ...
http://httpd.apache.org/docs/2.0/howto/cgi.html

HTH,
Marty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090224/d423440d/attachment.htm>


More information about the Tutor mailing list