How to setup webserver for Python

Nagy László Zsolt nagylzs at freemail.hu
Thu Jul 3 06:37:04 EDT 2003


>
>
>Hello,
>I have a webhosting account with one company.
>I can use python from command line through Telnet(SSH) but can not run successfully 
>Python program from a browser.(They use Apache web server.)
>What must I do?
>What permission must I set on directory and the python file?
>Here is a simple program I would like to run 
>########
>#!/usr/bin/python 
>print "Content-Type: text/html"    print
>print"AAA"
>########
>Thanks for help
>Ladislav
>
>I look forward to hearing from you soon.
>  
>
I think you should configure Apache for you directory (containing the 
script) to be a CGI direcory.
Option: ExecCGI. Please see Apache documentation. Probably you cannot 
change apache configuration
directly on the site because it is a hosting site serving many clients. 
However, you can do almost the same
with .htaccess files. Again, see Apache docs for details.

About permissions. You should know who is the user running the apache 
process. (It is usually apache, nobody or www.)
You should setup your CGI script in a way that the user running apache 
can run your CGI script too.

Cheers,

Laci 1.0







More information about the Python-list mailing list