From 335453691906848238f0f1efe87e5352db27671a Mon Sep 17 00:00:00 2001 From: Sylar012 Date: Mon, 12 Feb 2018 23:02:47 +0800 Subject: [PATCH] add index function --- examples/WebTrader/run.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/WebTrader/run.py b/examples/WebTrader/run.py index 9ef13785..0072391e 100644 --- a/examples/WebTrader/run.py +++ b/examples/WebTrader/run.py @@ -45,7 +45,7 @@ with open("WEB_setting.json") as f: # 创建Flask对象 -from flask import Flask +from flask import Flask, send_file from flask.ext.restful import Api, Resource, reqparse from flask.ext.socketio import SocketIO from flask_cors import * @@ -593,6 +593,12 @@ class CtaStrategyVar(Resource): l = engine.getStrategyVar(name) return {'result_code':'success','data':l} + +######################################################################## +@app.route('/') +def index_html(): + """首页""" + return send_file( os.path.abspath('.') + '/web/index.html' ) # 注册资源 api.add_resource(Token, '/token')