-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path006ui.py
49 lines (40 loc) · 1.21 KB
/
006ui.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
40
41
42
43
44
45
46
47
48
49
# coding:utf-8
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
import json
import utils.uimethod
import utils.uimodules
define(name='port', default=8000, help='run port', type=int)
# define(name='version', default='0.0.1', help='version 0.0.1', type=str)
class Calcuatation:
def sum(selfs, a, b):
return a+b
class UiHandler(tornado.web.RequestHandler):
def fun(self):
return 'fun test OK'
def get(self):
username = self.get_argument('name', 'no')
self.render('07module.html',
username=username,
fun=self.fun,
cal=Calcuatation
)
if __name__ == '__main__':
tornado.options.parse_command_line()
app = tornado.web.Application(
handlers=[
(r'/ui', UiHandler),
],
debug=True,
template_path='templates',
# autoescape=None,
static_path='static',
ui_modules=utils.uimodules,
ui_methods=utils.uimethod,
)
http_server = tornado.httpserver.HTTPServer(app)
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()