a little more help with python server-side scripting

Steve Holden steve at holdenweb.com
Tue Feb 21 23:09:14 EST 2006


John Salerno wrote:
> I contacted my domain host about how Python is implemented on their 
> server, and got this response:
> 
> -------------------
> Hello John,
> 
> Please be informed that the implementation of python in our server is 
> through mod_python integration with the apache.
> 
> These are the steps needed for you to be able to run .py script directly 
> from browser for your webpage:
> 
> 1. Please use the below mentioned path for python:
> #!/usr/bin/env python
> 
> Furthermore, update us with the script path, so that we can set the 
> appropriate ownership and permissions of the script on the server.
> 
> If you require any further assistance, feel free to contact us.
> -----------------------
> 
> Unfortunately, I don't completely understand what it is I need to do 
> now. Where do I put the path they mentioned? And what do they mean by my 
> script path?

Don't worry, it looks as though they don't completely understand either :-)

Fortunately they've given you the information you need to run CGI
scripts. Try installing this script in your cgi-bin directory as test.py 
(you may have to set it executable):

#!/usr/bin/env python
#
import os
print "Content-Type: text/plain"
print
for t in os.environ.items():
     print "%s=%s" % t

If it runs when you access http://yourdomain/cgi-bin/test.py it looks 
like you're good to go!

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list