From 6fcd5016d4ef57373408e2e62395c4f6ac46e4dd Mon Sep 17 00:00:00 2001 From: lan-air Date: Fri, 9 Dec 2022 20:18:56 +0800 Subject: [PATCH] update index return --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index cf7ea3a..02ba680 100644 --- a/main.py +++ b/main.py @@ -18,6 +18,7 @@ app = FastAPI() if not os.path.exists('./static'): os.makedirs('./static') app.mount("/static", StaticFiles(directory="static"), name="static") +index_html = open('templates/index.html', 'r').read() # 过期时间 exp_hour = 24 # 允许错误次数 @@ -58,7 +59,7 @@ def get_file_name(key, ext, file): @app.get('/') async def index(): with open('templates/index.html', 'r') as f: - return HTMLResponse(f.read()) + return HTMLResponse(index_html) @app.post('/')