InterviewSolution
| 1. |
What is the difference between CGI and WSGI? |
|
Answer» CGI, which stands for Common Gateway Interface, is a set of standards for the HTTP server to RENDER the output of executable scripts. CGI is one of the earliest technologies to be used for rendering dynamic content to the client of a web application. All major http web server software, such as Apache, IIS etc are CGI aware. With proper configuration, executable scripts written C/C++, PHP, Python, PERL etc can be executed on the server and the output is dynamically rendered in the HTML form to the client’s browser. One important disadvantage of CGI is that the server starts a new PROCESS for every request that it RECEIVES from its clients. As a result, the server is likely to face severe bottlenecks and is slow. WSGI (Web Server Gateway Interface) on the other hand prescribes a set of standards for communication between web servers and web applications written in Python based web application frameworks such as Django, Flask etc. WSGI specifications are defined in PEP 3333 (Python enhanced PROPOSAL) WSGI enabled servers are designed to handle multiple requests concurrently. Hence a web application hosted on a WSGI server is faster. There are many self-contained WSGI containers available such as Gunicorn and Gevent. You can also configure any Apache server for WSGI by installing and configuring mod_wsgi module. Many shared hosting services are also available for deploying Python web applications built with Django, Flask or other web frameworks. Examples are Heroku, Google App Engine, PythonAnywhere etc. |
|