Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences and uses between WSGI, CGI, FastCGI, and mod_python in regards to Python?

I'm just wondering what the differences and advantages are for the different CGI's out there. Which one would be best for python scripts, and how would I tell the script what to use?

like image 730
Parker Avatar asked Oct 14 '10 20:10

Parker


People also ask

What is the difference between WSGI and CGI?

The WSGI application runs on the server, and acts as the interface between the server and web application written in a python. The CGI application runs on the server and processes requests passed by server.

Is WSGI a CGI?

However, mod_python was not an official specification. It was simply created so they could run Python code on a server. Unfortunately, it was insecure, and developers began to look for a new solution. WSGI is a descendant of CGI, or Common Gateway Interface.

What is Mod_python WSGI?

mod_wsgi is an Apache HTTP Server module by Graham Dumpleton that provides a WSGI compliant interface for hosting Python based web applications under Apache. As of version 4.5.

How does Fast CGI work?

Basically, FastCGI is a program that manages multiple CGI requests within a single process, saving many program instructions for each request. Without FastCGI, each instance of a user requesting a service causes the Web server to open a new process that gets control, performs the service, and then is closed.


2 Answers

A part answer to your question, including scgi.

  • What's the difference between scgi and wsgi?
  • Is there a speed difference between WSGI and FCGI?
  • How Python web frameworks, WSGI and CGI fit together

CGI vs FCGI

Lazy and not writing it on my own. From the wikipedia: http://en.wikipedia.org/wiki/FastCGI

Instead of creating a new process for each request, FastCGI uses persistent processes to handle such requests. Multiple processes can configured, increasing stability and scalability. Each individual FastCGI process can handle many requests over its lifetime, thereby avoiding the overhead of per-request process creation and termination

like image 156
pyfunc Avatar answered Sep 20 '22 15:09

pyfunc


There's also a good background reader on CGI, WSGI and other options, in the form of an official python HOWTO: http://docs.python.org/2/howto/webservers.html

like image 24
Richard Boardman Avatar answered Sep 17 '22 15:09

Richard Boardman