google ad

Example application

A WSGI-compatible “Hello World” application written in Python:

def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    yield 'Hello World\n'

Where:

    Line 1 defines a callable[4] 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.

No comments:

Post a Comment