What CGI Means and How to run CGI Programs in Python?

Sumant jha
2 min readJul 1, 2020

--

Here we are going to talk about CGI means and CGI Programming in Python. Let’s look at the topic we are going to discuss in this article.

Topics:

  1. What CGI Means?
  2. CGI Architecture
  3. CGI FUnctions
  4. HTTP Header
  5. Environment Variables
  6. First CGI Program using Python
  7. Advantages and Disadvantages

So first of all we are going to start with the basic CGI means and introduction of CGI Programming in Python. and then we will explain how it works? and moving further we will explain about CGI Functions and HTTP Headers. and we will make our first CGI Program in Python after CGI means. And finally, we will see some advantages and disadvantages of CGI Programming in Python.

What CGI Means?

So first we will understand CGI programming in Python. So what exactly CGI means is? Basically, CGI means Common Gateway Interface. So what happens when you click on any of the links on the web page. I mean your browser contacts the HTTP web server and demands for the URL that is the file name. The web server passes the URL and looks for the file name and if it’s found that file it sends this file back to the browser. Otherwise, send the error message indicating that you requested a wrong file. and then the web browser takes the response from the web server and displays the received file or the error message.

However, it is possible to set up the HTTP server so that whenever a file in certain directories is requested that file is not syntax. Instead, it is executed as a program. And whatever program outputs, it sends back to the browser to display. So this function is called CGI or Common Interface and programs are called CGI scripts. These CGI scripts can be Python scripts, it can be a Perl script, Shell scripts, C and C++ programs etc.

CGI or Common Gateway Interface is the industry-accepted acronym for a set method that is used to define how data is transferred between the web server and a custom script. As of day, the CGI scripts are officially maintained by NCSA.

Read complete article

--

--

No responses yet