Configuring Xampp to host Python sites

  • Go to your xampp directory.
  • Then go to apache->conf folder.
  • There you can see httpd.conf file.Open it and look for,

“AddHandler cgi-script .cgi .pl .asp”

  • and add “.py” to it.
  • Now write a python program and place it htdocs folder.
  • Go to your browser and go the file in the localhost.

Eg python program is as follows,

#!C:\Python34\python.exe
import cgitb
cgitb.enable()
print (“Status: 200 OK\n”)
print (“<p><h1>It Works!</h1></p><h2><i>It Again Works!</i></h2>”)