|
python on xamppI spent most of today (Dec 14 2009) messing around trying to get xampp to interpret python scripts. Usually xampp only works with php, at least on my windows system (windows 32 bit vista). But since I'm developing something for a python server I needed to get it to work. I read a lot, found a heap of documentation about mod_python (mod_python.so), and only after half a day found out that that's really not a very nice solution. And I already had python 2.5 installed as well. mod_python seems nice, and has a lot of links to it on google, but it's overkill/weird and rarely needed. So, if you're like me, and have python & xampp installed on your system (and your pythonpath set in the environment variables), and need .py files to work... just do this.Configuring the server
In the httpd.conf file for your apache installation (part of xampp) add the following all the way at the bottom. In my case the httpd.conf can be found here: C:\xampp\apache\conf
# Configuring the python script Then in the top of the python script on your server, it already knows it should be python, but it doesn't know yet where the python program is. So as the very first line in your python scripts on the server you have to say where python is installed. In my case that looks like this
#!C:/Python25/python.exe Enabling index.pyOf course it's nice to have index.py files work just like index.php ones as well. So I added index.py to the following bit in the httpd.conf
# That's it Now .py files are also interpreted by python on a xampp installed apache server, just like .php. I hope that helps you as much as it dit me, and maybe saves you some time. Dolf |
Swedish proverb
När man talar om trollen så står de i farstun och lyssnar When you´re speaking about the trolls, they´re standing in the entrance hall and listen |