-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
38 lines (32 loc) · 1.04 KB
/
app.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
#!/usr/bin/env python
# -*- encoding=utf8 -*-
import tornado.ioloop
import tornado.web
import os
from tornado.options import define, options
define("port", default=8080, help="port to listen", type=int)
define("debug", default=True, help="run in debug mode")
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html")
class ZhiHandler(tornado.web.RequestHandler):
def get(self):
self.render("zhi.html")
class XingHandler(tornado.web.RequestHandler):
def get(self):
self.render("xing.html")
def make_app():
return tornado.web.Application([
(r"/", IndexHandler),
(r"/zhi", ZhiHandler),
(r"/xing", XingHandler),
],
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
xsrf_cookies=True,
debug=options.debug,
)
if __name__ == "__main__":
app = make_app()
app.listen(options.port)
tornado.ioloop.IOLoop.current().start()