You are invited to Log in or Register a free Frihost Account!

What is the difference between CGI and python script?

There are a lot of web hosting sites supporting CGI. Is there any way to convert python scripts to CGI, so python script can be run on those web sites. I tried some python scripts on those web sites, but none of them worked.
It is a common misconception that CGI is a programming language. CGI is basically a standard which allows a developer to use a standard application's output as the output sent back by a webserver as the response to a request.

For ex., if you request a page, your web browser connects to, and sends in an HTTP request. The server sends back a 'response'. Now, that is the standard model of a client-server transaction. Earlier, the servers were actually 'written' to cater specific requests and thereby provide dynamic response. But, what CGI does is, it allows us to use the outputs of a program as the response to a request. In this case, when you go to, assuming google uses python, the server at google will ask the python interpretor to run a script [a designated script for the index page, lets say] and return whatever is the ouptut of that script.

Now, the application can be anything. It can be a .exe file, a script to be run by an interpretor [Perl/Python/Ruby/PHP].

Python is a general-purpose programming language. For example if a script on running through the python interpretor, prints 'Hello World', when run through CGI, for ex. at a point, your browser will display the words 'Hello World'. Now, the folder 'cgi-bin' is pretty important. It's another misconception that only the scripts in the cgi-bin are executed through CGI and others are considered as standard text files. A server has some directories only the ones which allow the execution of a CGI app. For historical and conventional reasons, this folders has come to be 'cgi-bin'.

In your case mostly, you just need to place your python script in the proper folder and make sure your web server supports python.


Tutorials and help with Python/CGI:
thanks for the explains about CGI.... thank you very much!
Related topics
D difference between Anime and Tokusatsu... anyone know??
Difference between a Jr. Admin & MOD
Difference between watch & wife.
Is there a difference between "I know" and "I
python script???
Difference between Contests and Marketplace.
Whats the difference between Core Duo and Hyperthreading?
what is the difference between primary partition?
What is the Difference Between Love and Affection
What is the difference between these?
difference between windows xp service pack and sp 2 rc 1
difference between Pentium D, Pentium 4 and AMD Athlon
What is the difference between UNSIGNED and UNSIGNED ZEROFIL
Difference between assert and raise - Python
Reply to topic    Frihost Forum Index -> Scripting -> Others

© 2005-2011 Frihost, forums powered by phpBB.