I have a CGI script that I wrote in python to use as the home page of the website I am creating. Everything works properly except when you view the page instead of seeing the page that it outputs you see the source code of the page, why is this? I dont mean that it shows me the source code of the .py file, it shows me all the printed information as if I were looking at a .htm file in notepad.
Add the following before you print anything
print "Content-type: text/html"
Probably your script is not getting executed.
Is your python script executable?
Check whether you have the script under cgi-bin directory.
Python CGI - Script outputs source of generated page