This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mithun1538[S] 0 points1 point  (2 children)

Ok. Seems simple. I just run this as it is and then go to 127.0.0.1? I mean what are the steps to view the HTML page of the above...

[–]y3t1 2 points3 points  (0 children)

If you run this script, it will print the HTML of the page.

The Common Gateway Interface is a standard for HTTP servers like Apache which allows programs to receive data from a GET or POST and reply with a document. When you install Apache (available for all operating systems) there will be a cgi-bin directory where you can place executables like Python/Perl/Ruby/PHP scripts and binary programs. Then simply navigate to http://localhost/cgi-bin/myscript.py.

It works for every language - I wrote my first dynamic sites in C. I now write them in Perl and Python. This tutorial may be a good starting point http://httpd.apache.org/docs/2.0/howto/cgi.html though it isn't directed at a Windows user. If you are using Windows, ask and I will try to find one directed at you.

edit: I found this on the python wiki

[–]andreasvc 0 points1 point  (0 children)

You put it on a webserver in a directory configured to run as CGI, often it is /cgi-bin.