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:

    “The main object of a revolution is the liberation of man ... not the interpretation and application of some transcendental ideology.”
    —Jean Genet (1910–1986)

    “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)