update index return

This commit is contained in:
lan-air
2022-12-09 20:18:56 +08:00
parent b557b5edb8
commit 6fcd5016d4
+2 -1
View File
@@ -18,6 +18,7 @@ app = FastAPI()
if not os.path.exists('./static'): if not os.path.exists('./static'):
os.makedirs('./static') os.makedirs('./static')
app.mount("/static", StaticFiles(directory="static"), name="static") app.mount("/static", StaticFiles(directory="static"), name="static")
index_html = open('templates/index.html', 'r').read()
# 过期时间 # 过期时间
exp_hour = 24 exp_hour = 24
# 允许错误次数 # 允许错误次数
@@ -58,7 +59,7 @@ def get_file_name(key, ext, file):
@app.get('/') @app.get('/')
async def index(): async def index():
with open('templates/index.html', 'r') as f: with open('templates/index.html', 'r') as f:
return HTMLResponse(f.read()) return HTMLResponse(index_html)
@app.post('/') @app.post('/')