[Tutor] Cannot run .py file from apache web server , Guidance requested
Bob Gailer
bgailer at alum.rpi.edu
Tue Jan 31 16:24:25 CET 2006
John Joseph wrote:
> Hi
> I am trying to execute .py scripts from my
> apache web server , but it is not giving the results
> as how I run php files , it just displays the
> contents of the script , I am able to run and get
> results of PHP from the same loaction
> my “sample-test.py “file is as follows
>
For python scripts to run in my Apache2Triad installation the script
must start with #!h:/apache2triad/python/bin/python.exe
I suggest you add a similar comment (with your path to python.exe). When
I remove that line I get Server Error 500. So I think there is more
involved. In my Apache httpd.conf (configuration file) is the following:
#python config
LoadFile python\bin\python23.dll
#LoadModule python_module modules/mod_python.so
<IfModule mod_python.c>
Alias /python/ "h:/apache2triad/python/"
AddHandler python-program .spy
PythonHandler run_spyceModpy::spyceMain
AddHandler mod_python .psp
PythonHandler mod_python.psp
PythonDebug On
</IfModule>
Do you have anything like that in yours?
> import cgi
> reshtml = '''Content-Type: text/html\n
> <HTML><HEAD><TITLE> Friends CGI Demo (dynamic screen)
> </TITLE></HEAD>
> <BODY><H3>Friends list for: <I> Joseph </I></H3>
> Your name is: <B>John </B><P>
> You have <B> 20</B> friends.
> </BODY></HTML>'''
> When I access this script from the url
> “http://192.168.20.99/~john/ sample-test.py”
> in the browser I see the contents of the file , not
> the result
>
> Is there any function similar to phpino() in python ,
> so that I can test
> Guidance requested ,
> Joseph John
>
>
>
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
More information about the Tutor
mailing list