Objective: XAMPP is already installed in a Windows environment and we are accustomed to maintaining websites based on PHP as the programming language. But what about Python?
* Download Python: https://www.python.org/ftp/python/3.4.4/python-3.4.4.amd64.msi
* The download directory is C:\Python34\ (less than 100 MB space requirements)
* In the command prompt enter: set path=%path%;C:\Python34\
* Check the path: echo %path%
* Check presence of Python (case sensitive!): where Python (outputs c:\Python34\python.exe)
* Create host py.localhost
* create a file index.py
#!/Python34/python print("Content-Type: text/plain;charset=utf-8") print() print("Hello World!")
* On the command-line enter py index.py (outputs “hello world”)
* In order to run the same file in de web browser open the c:\xampp\apache\httpd.conf file and
* change the line “AddHandler cgi-script .cgi .pl .asp”
* to the line “AddHandler cgi-script .cgi .pl .asp .py”
* restart the webserver
* The url py.localhost/index.py should now display “hello world”
* Python3 is not at all compatible with Python2. Make sure you have the correct documentation in front of you
* Running Python in CGI mode is not at all the recommended way but will do for now. But should it be mod_wsgi? Mod_python? FastCGI? SCGI?
* Better still : http://www.ampps.com/ the XAMPP killer that has Python included by default
* Netbeans has a Python plugin. Instructions here.