提交 ce1189f2 编写于 作者: Q qiaolongfei

support default path

上级 3b723ecc
......@@ -2,15 +2,14 @@
"""
import json
import os
import sys
from optparse import OptionParser
from flask import send_from_directory
from flask import Flask
from flask import request
from flask import Flask, redirect
from flask import send_from_directory
from visualdl.log import logger
app = Flask(__name__, static_url_path="")
......@@ -46,21 +45,24 @@ def gen_result(status, msg):
result['data'] = {}
return result
@app.route('/')
def root():
return app.send_static_file('index.html')
@app.route('/js/<path:filename>')
server_path = os.path.abspath(os.path.dirname(sys.argv[0]))
static_file_path = "../visualdl/frontend/dist/"
@app.route('/static/<path:filename>')
def serve_static(filename):
root_dir = os.path.dirname(os.getcwd())
return send_from_directory(os.path.join('.', 'dist'), filename)
print("aaa")
return send_from_directory(os.path.join(server_path, static_file_path), filename)
@app.route('/hello')
@app.route("/")
def index():
"""
return redirect('/static/index.html', code=302)
:return:
"""
@app.route('/hello')
def hello():
result = gen_result(0, "Hello, this is VisualDL!")
return json.dumps(result)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册