Reputation: 285
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 print
ed information as if I were looking at a .htm file in notepad.
Upvotes: 0
Views: 532
Reputation: 249
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.
Upvotes: 2
Reputation: 174748
The default Content Type is text, and if you forgot to send the appropriate header in your CGI file, you will end up with what you are seeing.
Upvotes: 1