/
code.py
39 lines (31 loc) · 810 Bytes
/
code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import web
import todolist.todo
import blog.blog
import skeleton.code
import wiki.wiki
urls = (
"/(.*)/", "Redirect",
"/todo", todolist.todo.app,
'/blog', blog.blog.app,
'/skeleton', skeleton.code.app,
'/wiki', wiki.wiki.app,
"/.*", "Index"
)
render = web.template.render('templates', base='base')
class Redirect:
def GET(self, path):
web.seeother('/' + path)
class Index:
def GET(self):
pages = {
"todo": '/todo',
'blog': '/blog',
'skeleton': '/skeleton',
'wiki': '/wiki'
}
return render.index(pages)
app = web.application(urls, locals())
if __name__ == "__main__":
app.run()