提交 972f7447 编写于 作者: Q qiaolongfei

add serve static files

上级 da3091b9
""" entry point of visual_dl """ entry point of visual_dl
""" """
import json import json
import os
from optparse import OptionParser from optparse import OptionParser
from flask import send_from_directory
from flask import Flask from flask import Flask
from flask import request from flask import request
from visualdl.log import logger from visualdl.log import logger
app = Flask(__name__)
app = Flask(__name__, static_url_path="")
def option_parser(): def option_parser():
...@@ -43,8 +46,16 @@ def gen_result(status, msg): ...@@ -43,8 +46,16 @@ def gen_result(status, msg):
result['data'] = {} result['data'] = {}
return result return result
@app.route('/') @app.route('/')
def root():
return app.send_static_file('index.html')
@app.route('/js/<path:filename>')
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(): def index():
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册