Python can be used as CGI scripts in the development of different websites. CGI scripts act as a standard protocol between an application and the web server. The HTML page which is fetched by the HTTPd is static, and CGI is used to generate dynamic content and is 'executed in real time. For example, you need to search a record on a database server, so a web page like google.com will be provided to you. After you enter the search string, the web server deamon will run the respective CGI program to send the information to the database server and then receive the result and display it back to the client's browser.
In other words, you are allowing the web server deamon. to run a program on the server. The advantage of using CGI is that it is very simple to write programs but is recommended for low load applications. As each time a request comes from the client a new Python interpretor is loaded, hence making things slower.
FastCGI is another concept similar to CGI but a better option than CGI. In case of FastCGI, a new process gets started which runs behind the web server independently. Hence whenever a request is generated, the application gets executed without loading the interpretor as was the case with CGI. This results in better performance.




Reply With Quote
Bookmarks