-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (29 loc) · 940 Bytes
/
main.py
File metadata and controls
34 lines (29 loc) · 940 Bytes
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
# Bokeh runner
import tornado.web
from bokeh.application import Application
from bokeh.application.handlers import FunctionHandler
from bokeh.server.server import Server
from src import visualiser, api, edit
def run_server():
server = Server(
{"/visualiser": Application(FunctionHandler(visualiser.main))},
extra_patterns=[
("/api", api.ApiHandler),
("/edit", edit.EditHandler),
("/ping", api.PingHandler),
(r"/my_static/(.*)", tornado.web.StaticFileHandler, {"path": "my_static/"}),
],
allow_websocket_origin=[
"hegel.eecs.qmul.ac.uk:5006",
"attackgraphs.eecs.qmul.ac.uk",
"localhost:5006",
],
)
server.start()
server.io_loop.start()
if __name__ == "__main__":
print(
"Opening Tornado app with embedded Bokeh application "
"on http://localhost:5006/"
)
run_server()