Search code examples
pythoncgiwsgi

What are WSGI and CGI in plain English?


Every time I read either WSGI or CGI I cringe. I've tried reading on it before but nothing really has stuck.

What is it really in plain English?

Does it just pipe requests to a terminal and redirect the output?


Solution

  • WSGI runs the Python interpreter on web server start, either as part of the web server process (embedded mode) or as a separate process (daemon mode), and loads the script into it. Each request results in a specific function in the script being called, with the request environment passed as arguments to the function.

    CGI runs the script as a separate process each request and uses environment variables, stdin, and stdout to "communicate" with it.