From f3ad66010a558a8e9d30ba6b46c0126811ec8d25 Mon Sep 17 00:00:00 2001 From: CodeKpy <1942171924@qq.com> Date: Thu, 10 Apr 2025 02:37:23 +0000 Subject: [PATCH 1/2] =?UTF-8?q?test=EF=BC=9A=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=A8=A1=E6=9D=BF=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: CodeKpy <1942171924@qq.com> --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 67cda3e..ed64dc0 100644 --- a/main.py +++ b/main.py @@ -37,6 +37,7 @@ relative_path = venv_path # 获取绝对路径 absolute_path = os.path.abspath(os.path.join(base_dir, relative_path)) +# TODO:修复模板路径问题 app = Flask(__name__, template_folder='./', static_folder='./') # 判断是否存在project虚拟环境,不存在则创建 @@ -64,17 +65,17 @@ if not os.path.exists('project'): f.write(json.dumps(data)) -# 定义一个路由,当访问根目录时,返回editor.html模板 +# 定义一个路由,当访问根目录时,返回index.html模板 @app.route('/') def index(): # 如果 Cookie 不存在或为空,设置一个默认值 if not request.cookies.get('currentProjectPath'): # 创建一个响应对象 - response = make_response(render_template('index.html')) + response = make_response(render_template('/dist/index.html')) # 设置 Cookie response.set_cookie('currentProjectPath', value=absolute_path, max_age=3600*24*7) return response - return render_template('index.html') + return render_template('/dist/index.html') @app.route('/docs/') -- Gitee From 2dad2f1e3d7f81c47eadaa3811a555a1751746b2 Mon Sep 17 00:00:00 2001 From: Codepy <1942171924@qq.com> Date: Sat, 12 Apr 2025 22:00:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?upd=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index ed64dc0..8aa4e2d 100644 --- a/main.py +++ b/main.py @@ -93,7 +93,7 @@ def static_proxy(path): def api(api): if not request.cookies.get('currentProjectPath'): # 创建一个响应对象 - response = make_response(render_template('index.html')) + response = make_response(render_template('/dist/index.html')) # 设置 Cookie response.set_cookie('currentProjectPath', value=absolute_path, max_age=3600*24*7) return response -- Gitee