Example Application
A WSGI-compatible “Hello World” application written in Python:
def application(environ, start_response): start_response('200 OK', ) yield 'Hello World\n'Where:
- Line 1 defines a callable named
application
, which takes two parameters,environ
andstart_response
.environ
is a dictionary containing environment variables in CGI.start_response
is a callable taking two required parametersstatus
andresponse_headers
. - Line 2 calls
start_response
, specifying "200 OK" as the status and a "Content-Type" header. - Line 3 returns the body of response as a string literal.
Read more about this topic: Web Server Gateway Interface
Famous quotes containing the word application:
“Courage is resistance to fear, mastery of fearnot absence of fear. Except a creature be part coward it is not a compliment to say it is brave; it is merely a loose application of the word. Consider the flea!incomparably the bravest of all the creatures of God, if ignorance of fear were courage.”
—Mark Twain [Samuel Langhorne Clemens] (18351910)
“The receipt to make a speaker, and an applauded one too, is short and easy.Take of common sense quantum sufficit, add a little application to the rules and orders of the House, throw obvious thoughts in a new light, and make up the whole with a large quantity of purity, correctness, and elegancy of style.”
—Philip Dormer Stanhope, 4th Earl Chesterfield (16941773)