зачем использовать wsgiref simple_server?

У меня есть простое веб-приложение, которое нужно создать, и я только начинаю возиться с mod_wsgi. В различных руководствах, первое приложение hello world выглядит примерно так:

def application(environ,start_response):
   response_body = 'Hello World'
   status = '200 OK'

   response_headers = [('Content-Type', 'text/plain'),
                       ('Content-Length', str(len(response_body)))]

   start_response(status, response_headers)
   return [response_body]

Затем, позже приложение включает сервер wsgi с использованием wsgiref, некоторый вариант:

from wsgiref.simple_server import make_server

def application(environ, start_response):
    response_body = 'Hello World'
    status = '200 OK'

    response_headers = [('Content-Type', 'text/plain'),
                           ('Content-Length', str(len(response_body)))]

    start_response(status, response_headers)
    return [response_body]

httpd = make_server('localhost', 8000, application)
httpd.serve_forever()

Приложение работает без сервера, так для чего этот сервер?

6
задан jmilloy 11 March 2011 в 21:32
поделиться