Python CGI setup (for Hostgator hosting)

In this post we will enable Python CGI for Hostgator

Create a .htaccess file and put following contents in this file:

This will make the web server to interprete .py file as Python CGI script.


Next create a python file (named here) with following code:

And set this file's permission setting so that Owner, Group and Public have "execute" permission for this file (Or set 755 permission simply)

Visit http://server_address/app_path/, you will see a page with "hello" printed.



The first two lines of code is necessary, otherwise you will get a "500 Internal Server Error".