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>”)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s