Commit | Line | Data |
---|---|---|
8774cda2 FT |
1 | import sys, ashd.wsgiutil |
2 | ||
3 | n = 0 | |
4 | ||
5 | def application(env, startreq): | |
6 | global n | |
7 | startreq("200 OK", [("Content-Type", "text/html")]) | |
8 | yield "<html>\n" | |
9 | yield "<head><title>Hello world from Python!</title></head>\n" | |
10 | yield "<body>\n" | |
11 | yield "<h1>Hello world from Python/WSGI!</h1>\n" | |
12 | yield "<p>Do note how the single-process nature of <code>ashd-wsgi</code> " | |
13 | yield "allows data to be kept in memory persistently across requests, and " | |
14 | yield "how the following counter increases by one for each request: " + str(n) + "</p>\n" | |
15 | n += 1 | |
16 | yield "<p>This script is a very raw WSGI example, using no glue code " | |
17 | yield "whatever, but you should be able to use whatever WSGI middleware " | |
18 | yield "you like in order to make it easier to code WSGI. If you have no " | |
19 | yield "particular preference, I might recommend " | |
20 | yield "<a href=\"http://www.dolda2000.com/gitweb/?p=wrw.git;a=summary\">WRW</a>, " | |
21 | yield "my WSGI Request Wrapper library, which is particularly made for " | |
22 | yield "<code>ashd-wsgi</code> and therefore, for instance, allows " | |
23 | yield "non-pickleble objects (like sockets) to be stored in sessions.</p>" | |
24 | yield "<p>If you have installed the Python3 utilities as well, there is " | |
25 | yield "also a <a href=\"py3\">Python3 script</a> to demonstrate that " | |
26 | yield "Python3 is supported as well.\n" | |
27 | yield "<p>The current Python interpreter is <code>" + ashd.wsgiutil.htmlquote(sys.version) + "</code>.</p>" | |
28 | yield "</body>\n" | |
29 | yield "</html>\n" |