From de5fc89024fe60fd8470e22416af8eeb441e9e0e Mon Sep 17 00:00:00 2001 From: wataru Date: Fri, 2 Sep 2022 12:06:44 +0900 Subject: [PATCH] flask index --- demo/serverFlask.py | 15 +++++++++++++-- start2.sh | 2 +- trainer/Dockerfile | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/demo/serverFlask.py b/demo/serverFlask.py index b722d279..7663cd85 100755 --- a/demo/serverFlask.py +++ b/demo/serverFlask.py @@ -1,4 +1,4 @@ -from flask import Flask, request, Markup, abort, jsonify +from flask import Flask, request, Markup, abort, jsonify, send_from_directory from flask_cors import CORS import logging from logging.config import dictConfig @@ -37,7 +37,18 @@ dictConfig({ } }) -app = Flask(__name__, static_folder="../frontend/dist", static_url_path='/') + +#app = Flask(__name__, static_folder="../frontend/dist", static_url_path='/') + +app = Flask(__name__) +@app.route("/") +def static_dir(path): + return send_from_directory("../frontend/dist", path) + +@app.route('/', methods=['GET']) +def redirect_to_index(): + return send_from_directory("../frontend/dist", 'index.html') + CORS(app, resources={r"/*": {"origins": "*"}}) class VoiceChanger(): diff --git a/start2.sh b/start2.sh index 55750a2b..2f765406 100644 --- a/start2.sh +++ b/start2.sh @@ -2,7 +2,7 @@ # 参考:https://programwiz.org/2022/03/22/how-to-write-shell-script-for-option-parsing/ -DOCKER_IMAGE=dannadori/voice-changer:20220902_113334 +DOCKER_IMAGE=dannadori/voice-changer:20220902_120553 TENSORBOARD_PORT=6006 VOICE_CHANGER_PORT=8080 diff --git a/trainer/Dockerfile b/trainer/Dockerfile index 34ad79c4..feaf9a96 100644 --- a/trainer/Dockerfile +++ b/trainer/Dockerfile @@ -1,4 +1,4 @@ -FROM dannadori/voice-changer-internal:20220902_113223 as front +FROM dannadori/voice-changer-internal:20220902_120454 as front FROM debian:bullseye-slim as base ARG DEBIAN_FRONTEND=noninteractive