Ian Bicking’s Python Paste jar of goods (and WebOb) is a testament to having a standardized web application protocol like WSGI. Rather than making the hard choice between starting with a framework like Django or starting from scratch, we can a mix and match libraries and build our fully-customized stack, all the while learning about Python web development and each other and our bodies and so on. For example, suppose Bill is on line three, screaming down your ear about choosing a WSGI development server by the end of this hour, dammit so everybody can deploy applications in a uniform way. Your first instinct is to, of course, grab madly at Paste Script, which takes a Paste Deploy configuration file and dutifully runs applications like nobody’s business.
Jump.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.