diff --git a/bin/visual_dl.py b/bin/visual_dl.py index 3efef160cbc8561bdac0e01307c9975f8194c4c6..8c0e261ec1a61eb9662fb58e38331df8fbe7f1cd 100644 --- a/bin/visual_dl.py +++ b/bin/visual_dl.py @@ -1,14 +1,17 @@ """ entry point of visual_dl """ import json +import os from optparse import OptionParser +from flask import send_from_directory from flask import Flask from flask import request from visualdl.log import logger -app = Flask(__name__) + +app = Flask(__name__, static_url_path="") def option_parser(): @@ -43,8 +46,16 @@ def gen_result(status, msg): result['data'] = {} return result - @app.route('/') +def root(): + return app.send_static_file('index.html') + +@app.route('/js/') +def serve_static(filename): + root_dir = os.path.dirname(os.getcwd()) + return send_from_directory(os.path.join('.', 'dist'), filename) + +@app.route('/hello') def index(): """