riclags wrote:I've gone through this (http://community.apachefriends.org/f/viewtopic.php?f=16&t=34468) tutorial/how-to but I was wondering if there are any current ways to use Python with XAMPP as the mentioned post is 3 years old.
It may be still working, but I would not do so anyway. I dont like the "Registry Hack" and recommend to go the "standard CGI" installation.
riclags wrote:(1) Which directory are the .reg files placed? Is it under XAMPP or the Python directory?
Anyhwere is ok, because this file is NOT used at runtime, you have to "double click" after creation what imports the contents into to your Windows Registry. Anyway, i do not recommend this Registry Hack.
riclags wrote:(2) The shebang portion of the Python code also uses #!/usr/bin/python; is this correct?
Of course NOT, that is the UNIX Pathname of Python. You have to replace that by the real pathname of your Python installation (i.e. #!c:/python/bin/python.exe or similar). If that pathname contains spaces (not recommended) you have to put double quotes around the pathname (#!"c:/program files/python/bin/python.exe"), but it looks ugly anyway.
There is no need for the Registry Hack if you use the Shebang Line instead. If you give *.cgi as extension to your python scripts, it should run "out of the box". If you would like to use a different extension (for example *.py) you only have to edit one line in httdp,conf. Look for "AddHandler cgi-script .cgi ...." (there may be already more than one extension) and simply add .py to this AddHandler (leave one space between the extensions).
Then restart Apache, use the right Shebang Line and thats it - forget everyhing about Registry. If you want CGI scripts being executed in your DocumentRoot (or subsequent folders), apply Option "ExecCGI" in the <Directory ...> Configuration (what is already the case for Xampp installations).