bor.borygmus

A programming weblog by Hao Lian. • A long walk through an angry forest. • A series of memory leaks brought on by senility.

Ian Bicking’s Python Paste jar of goods is more or less a testament to the power of having a standardized web protocol like WSGI. We can use and abuse the Paste Script like a futon to quickly run Python web applications without the hassle of a big web server.

Jump.
[(April 2, 2009) .]

All modern Python servers—except mod_python—talk to the application using the same pseudo-protocol called the Python Web Server Gateway Interface (WSGI).

Old-timies out there will recognize the parallels in naming the WSGI after the Common Gateway Interface, which was spectacularly simple. A browser connects to the web server. The web server runs perl website.pl or python website.py. Your HTTP request, headers and all, is sent through via standard input. Your HTTP response, headers and text and all, is sent through via standard output.

One process for every request. Simple. Slow.

Starting up an interpreter each time bogs you down. A better solution is to keep the interpreter around for multiple requests. Or, better yet, start a whole farm of fuzzy little interpreters. They run around, eagerly trying to fulfill your HTTP requests until they’re plump enough to be brutally decapitated in a mass orgy of death-worship in order to become your HTTP bacon sandwiches.

Jump.
[(January 23, 2009) .]