Web Server Gateway Interface - Example Application

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 and start_response. environ is a dictionary containing environment variables in CGI. start_response is a callable taking two required parameters status and response_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 (1694–1773)

    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 (1613–1680)