def start(self):
application = tornado.web.Application([
(r'/ws', Server.WSHandler),
(r'/', Server.AppHandler),
(r'/blockly', Server.BlocklyHandler),
(r'/blockly/code/(.*)', tornado.web.StaticFileHandler, {'path': 'blockly'}),
(r'/stream', Server.StreamHandler),
(r'/stream/(.*)', tornado.web.StaticFileHandler, {'path': 'Web App/stream'}),
(r'blockly/code/msg/js/(en.js)', tornado.web.StaticFileHandler, {'path': 'blockly/msg/js'}),
(r'/(theme\.css)', tornado.web.StaticFileHandler, {'path': 'Web App'}),
(r'/(connector\.js)', tornado.web.StaticFileHandler, {'path': 'Web App'}),
(r'/image/(scratch\.png)', tornado.web.StaticFileHandler, {'path': 'Web App/images'}),
(r'/image/(blockly\.png)', tornado.web.StaticFileHandler, {'path': 'Web App/images'}),
(r'/image/(cozmo\.png)', tornado.web.StaticFileHandler, {'path': 'Web App/images'}),
])
print('[Server] Starting server...')
application.listen(9090)
print("[Server] Server ready at: localhost:9090")
print("[Server] Websockets ready at: localhost:9090/ws")
webbrowser.open("http://localhost:9090")
print("[Server] Web browser openned to: http://localhost:9090")
tornado.ioloop.IOLoop.instance().start()
print('[Server] Server stopped')
评论列表
文章目录