examples: Added an example for wsgidir usage.
[ashd.git] / examples / python / wsgidir / py3.wsgi3
CommitLineData
8774cda2
FT
1import sys, ashd.wsgiutil
2
3def application(env, startreq):
4 startreq("200 OK", [("Content-Type", "text/html")])
5 # Note that WSGI 3 requires returned data to be bytes, not strings.
6 yield b"<html>\n"
7 yield b"<head><title>Hello world from Python3!</title></head>\n"
8 yield b"<body>\n"
9 yield b"<h1>Hello world from Python3!</h1>\n"
10 yield b"<p>This example does nothing in particular except demonstrating "
11 yield b"that there is support for Python3 as well.</p>\n"
12 yield b"<p>The current Python interpreter is <code>" + ashd.wsgiutil.htmlquote(sys.version).encode("utf-8") + b"</code>.</p>"
13 yield b"</body>\n"
14 yield b"</html>\n"