def main(): parse_command_line() ssl_ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) ssl_ctx.load_cert_chain( os.path.join(os.path.dirname(__file__), 'test.crt'), os.path.join(os.path.dirname(__file__), 'test.key')) app = Application([('/', MainHandler)], debug=True) server = Server(app, ssl_options=ssl_ctx) server.listen(8443) logging.info("starting") IOLoop.instance().start()
def main(): define("port", default=8010, type=int, help="服务器监听端口号") define("address", default='0.0.0.0', type=str, help='服务器地址') define("content", default=[], type=str, multiple=True, help="控制台输出内容") parse_command_line() apps = Application(handlers=handlers, debug=True, autoreload=True, compress_response=True) try: port = QASETTING.get_config('WEBSERVICE', 'port', default_value=options.port) if port == options.port: QASETTING.set_config('WEBSERVICE', 'port', default_value=options.port) else: options.port = port except: # #print(port) QASETTING.set_config('WEBSERVICE', 'port', default_value=options.port) # print(options.content) #http_server = tornado.httpserver.HTTPServer(apps) http_server = Server(apps) print(port) http_server.bind(port, address=options.address) """增加了对于非windows下的机器多进程的支持 """ http_server.start(1) tornado.ioloop.IOLoop.current().start()
def main(): asyncio.set_event_loop(asyncio.new_event_loop()) define("port", default=8010, type=int, help="服务器监听端口号") define("address", default='0.0.0.0', type=str, help='服务器地址') define("content", default=[], type=str, multiple=True, help="控制台输出内容") parse_command_line() apps = Application(handlers=handlers, debug=True, autoreload=True, compress_response=True) port = options.port http_server = Server(apps) print('========WELCOME QUANTAXIS_WEBSERVER============') print('QUANTAXIS VERSION: {}'.format(__version__)) print('QUANTAXIS WEBSERVER is Listening on: http://localhost:{}'.format( port)) print('请打开浏览器/使用JavaScript等来使用该后台, 并且不要关闭当前命令行窗口') http_server.bind(port=options.port, address=options.address) """增加了对于非windows下的机器多进程的支持 """ http_server.start(1) tornado.ioloop.IOLoop.current().start()
def webserver(): handlers = [(r'/tradeaccounts', TradeAccountHandler), (r'/order', SendOrderHandler)] apps = Application(handlers=handlers, debug=True, autoreload=True, compress_response=True) http_server = Server(apps) http_server.bind('8020', address='0.0.0.0') http_server.start(1) IOLoop.current().start()
def main(): asyncio.set_event_loop(asyncio.new_event_loop()) define("port", default=8010, type=int, help="服务器监听端口号") define("address", default='0.0.0.0', type=str, help='服务器地址') define("content", default=[], type=str, multiple=True, help="控制台输出内容") parse_command_line() apps = Application( handlers=handlers, debug=True, autoreload=True, compress_response=True ) port = options.port # try: # port = QASETTING.get_config( # 'WEBSERVICE', # 'port', # default_value=options.port # ) # if port == options.port: # QASETTING.set_config( # 'WEBSERVICE', # 'port', # default_value=options.port # ) # else: # options.port = port # except: # # #print(port) # QASETTING.set_config('WEBSERVICE', 'port', default_value=options.port) # print(options.content) #http_server = tornado.httpserver.HTTPServer(apps) http_server = Server(apps) # http_server = Server(apps, ssl_options={ # "keyfile": "/Users/you/Documents/GitHub/ForecastingWeb/QAWebServer/rsa_keys/key.pem", # "certfile": "/Users/you/Documents/GitHub/ForecastingWeb/QAWebServer/rsa_keys/certificate.pem" # }) print('========WELCOME QUANTAXIS_WEBSERVER============') print('QUANTAXIS VERSION: {}'.format(__version__)) print('QUANTAXIS WEBSERVER is Listening on: http://localhost:{}'.format(port)) print('请打开浏览器/使用JavaScript等来使用该后台, 并且不要关闭当前命令行窗口') http_server.bind(port=options.port, address=options.address) """增加了对于非windows下的机器多进程的支持 """ http_server.start(1) tornado.ioloop.IOLoop.current().start()
def start_server(handlers, address, port): apps = Application(handlers=handlers, debug=True, autoreload=True, compress_response=True) http_server = Server(apps) print('========WELCOME QUANTAXIS_WEBSERVER============') print('QUANTAXIS VERSION: {}'.format(__version__)) print('QUANTAXIS WEBSERVER is Listening on: http://localhost:{}'.format( port)) print('请打开浏览器/使用JavaScript等来使用该后台, 并且不要关闭当前命令行窗口') http_server.bind(port=port, address=address) """增加了对于非windows下的机器多进程的支持 """ http_server.start(1) tornado.ioloop.IOLoop.current().start()
def main(): define("port", default=8010, type=int, help="服务器监听端口号") define("address", default='0.0.0.0', type=str, help='服务器地址') define("content", default=[], type=str, multiple=True, help="控制台输出内容") parse_command_line() apps = Application(handlers=handlers, debug=True, autoreload=True, compress_response=True) try: port = QASETTING.get_config('WEBSERVICE', 'port', default_value=options.port) if port == options.port: QASETTING.set_config('WEBSERVICE', 'port', default_value=options.port) else: options.port = port except: # #print(port) QASETTING.set_config('WEBSERVICE', 'port', default_value=options.port) # print(options.content) #http_server = tornado.httpserver.HTTPServer(apps) http_server = Server(apps) print('========WELCOME QUANTAXIS_WEBSERVER============') print('QUANTAXIS VERSION: {}'.format(__version__)) print('QUANTAXIS WEBSERVER is Listening on: http://localhost:{}'.format( port)) print('请打开浏览器/使用JavaScript等来使用该后台, 并且不要关闭当前命令行窗口') print('调试本地代码...') http_server.bind(port, address=options.address) """增加了对于非windows下的机器多进程的支持 """ http_server.start(1) tornado.ioloop.IOLoop.current().start()
def get_http_server(self): return Server(self._app, **self.get_httpserver_options())