| author | Tero Marttila <terom@fixme.fi> |
| Mon, 16 Feb 2009 19:02:59 +0200 | |
| changeset 77 | bef7196f7682 |
| parent 66 | d2ce81dd5e5d |
| permissions | -rwxr-xr-x |
| 6 | 1 |
#!/usr/bin/python2.5 |
2 |
||
|
7
d6a8258bd90e
YES YES MOAR WSGI - Hello World
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
3 |
""" |
| 66 | 4 |
Sample CGI main() function. |
5 |
||
6 |
This example runs site.SiteModuleCollection('sites')
|
|
|
7
d6a8258bd90e
YES YES MOAR WSGI - Hello World
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
7 |
""" |
| 6 | 8 |
|
| 66 | 9 |
def main () : |
|
16
4a40718c7b4b
better error handling of import errors in CGI, and split PageTree out from page.py into page_tree.py and tree_parse.py
Tero Marttila <terom@fixme.fi>
parents:
11
diff
changeset
|
10 |
""" |
| 66 | 11 |
Build our wsgi.Application and run |
|
7
d6a8258bd90e
YES YES MOAR WSGI - Hello World
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
12 |
""" |
| 11 | 13 |
|
14 |
try : |
|
| 66 | 15 |
from qmsk.web import wsgi, cgi_main, site |
|
31
107062ebb6f9
bloat code with even more layers of indirection, split off the filesystem-based stuff into a separate lib.filesystem package (next, move it to sites/www.qmsk.net)
Tero Marttila <terom@fixme.fi>
parents:
16
diff
changeset
|
16 |
|
|
107062ebb6f9
bloat code with even more layers of indirection, split off the filesystem-based stuff into a separate lib.filesystem package (next, move it to sites/www.qmsk.net)
Tero Marttila <terom@fixme.fi>
parents:
16
diff
changeset
|
17 |
# create app |
|
107062ebb6f9
bloat code with even more layers of indirection, split off the filesystem-based stuff into a separate lib.filesystem package (next, move it to sites/www.qmsk.net)
Tero Marttila <terom@fixme.fi>
parents:
16
diff
changeset
|
18 |
app = wsgi.Application(site.SiteModuleCollection('sites'))
|
|
16
4a40718c7b4b
better error handling of import errors in CGI, and split PageTree out from page.py into page_tree.py and tree_parse.py
Tero Marttila <terom@fixme.fi>
parents:
11
diff
changeset
|
19 |
|
|
4a40718c7b4b
better error handling of import errors in CGI, and split PageTree out from page.py into page_tree.py and tree_parse.py
Tero Marttila <terom@fixme.fi>
parents:
11
diff
changeset
|
20 |
# run once |
| 66 | 21 |
cgi_main.run(app) |
| 11 | 22 |
|
23 |
except : |
|
| 66 | 24 |
# display error on stdout |
25 |
cgi_main.error() |
|
|
7
d6a8258bd90e
YES YES MOAR WSGI - Hello World
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
26 |
|
|
d6a8258bd90e
YES YES MOAR WSGI - Hello World
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
27 |
if __name__ == '__main__' : |
| 66 | 28 |
main() |
29 |