Running Python scripts in a browser
Posted
by sunwukung
on Server Fault
See other posts from Server Fault
or by sunwukung
Published on 2010-04-29T00:47:03Z
Indexed on
2010/04/29
0:48 UTC
Read the original article
Hit count: 360
I want to start learning Python - and I'm having trouble getting scripts to load up in a browser (using Wamp). So far I've tried the following:
1: add the following lines to httpd.conf:
AddHandler cgi-script .py
Options ExecCGI
I navigate to
localhost/path/to/script/myscript.py
- but get an Internal Server error.
2: downloaded mod_wsgi-win32-ap22py26-3.0.so - renamed to mod_wsgi (running Wamp with Apache 2.2) added the following lines to httpd.conf
AddHandler mod_wsgi .py
WSGIScriptAlias /wsgi/ "path/to/my/pythonscripts/folder/"
but when I navigate to the script - it renders the script in it's entirety i.e.
#!c:/Python26/python.exe -u
print "hello world"
I managed to get CherryPy working, but ideally I want to learn the language in a relatively raw context before digging into a framework. Can anyone give me some pointers?
© Server Fault or respective owner