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:
“If you would be a favourite of your king, address yourself to his weaknesses. An application to his reason will seldom prove very successful.”
—Philip Dormer Stanhope, 4th Earl Chesterfield (16941773)
“There are very few things impossible in themselves; and we do not want means to conquer difficulties so much as application and resolution in the use of means.”
—François, Duc De La Rochefoucauld (16131680)