-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.py
44 lines (35 loc) · 1.06 KB
/
server.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
#!/usr/bin/python3
import tornado.ioloop
from tornado.web import Application
from tornado.options import define, options
from evalytics.handlers import \
EmployeesHandler, \
SurveysHandler, \
ReviewersHandler, \
CommunicationHandler, \
ResponseStatusHandler, EvalReportsHandler, \
PeersAssignmentHandler
define(
"port", default=8080,
help="Run tornado server on the given port", type=int)
class GetPathAndHandler:
def get(self):
handlers = [
PeersAssignmentHandler,
EmployeesHandler,
SurveysHandler,
ReviewersHandler,
CommunicationHandler,
ResponseStatusHandler,
EvalReportsHandler
]
return [(h.path, h) for h in handlers]
def main():
tornado.options.parse_command_line()
path_and_handler = GetPathAndHandler().get()
app = Application(path_and_handler)
http_server = tornado.httpserver.HTTPServer(app)
http_server.listen(options.port)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()