Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. CGI in python
  5. Architecture of CGI

Architecture of CGI

The Common Gateway Interface is a standard for external gateway programs to interface with the server, such as HTTP Servers.

Do you know what happens when you click any of the link on the web page?

I mean your browser contacts the HTTP web server and demands for the URL that is the file name and the web server passes the URL and looks for the file name and if it finds that file it sends back to the browser otherwise sends an error message indicating that you requested a wrong file.

And then the web browser takes response from the web server and displays either the received file or the error message.

However, it is possible to set up an HTTP server so that whenever a file in the certain directory is requested that the file is not sent back instead it is executed as a program and whatever that program outputs it send back to the browser to display.

So this function is called the common gateway interface or CGI.

Image source:- Google.

The data retrieved from the databases is converted in HTML format and sent to the webserver.

Taking a look at the CGI architecture when a request is made to the web server from the client server the common gateway interface uses external files or program to handle such requests and these programs or files can be written in any programming language but the main goal of these program is to retrieve data from the databases.

And the data retrieved from the databases is converted in HTML format and sent to the web server.

This is all about the architecture of CGI.

Was this article helpful to you? Yes 2 No

How can we help?