Seite 1 von 1

[WSGI] Hello World...

Verfasst: Samstag 26. November 2005, 22:07
von jens

Code: Alles auswählen

#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" Hello World!
used WSGI: http://wsgiarea.pocoo.org by Armin Ronacher <armin.ronacher@active-4.com>
"""

from __future__ import generators

from wsgi.middlewares import debug; debug.cgi_debug()
from wsgi.wrappers.basecgi import WSGIServer

from wsgi import http



class Application:

    def __init__(self, environ, start_response):
        self.environ = environ
        self.start_response = start_response

    def __iter__(self):
        self.start_response(http.get_status(200), [('Content-Type', 'text/html')])
        yield "Hello World!"


#___________________________________________________________________________

if __name__ == '__main__':
    app = Application
    WSGIServer(app).run()