update hotfix

This commit is contained in:
Wolfang Torres
2026-06-07 00:36:21 +08:00
parent 9be033535b
commit 3bb0caa64d
3 changed files with 21 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ from .mainapp import mainapp
def create_app(*args): def create_app(*args):
# create and configure the app # create and configure the app
app = Flask(__name__, instance_relative_config=True) app = Flask(__name__, instance_relative_config=True)
app.config['APPLICATION_ROOT'] = '/hsk' app.config["APPLICATION_ROOT"] = "/hsk"
# ensure the instance folder exists # ensure the instance folder exists
instance_path = Path(app.instance_path) instance_path = Path(app.instance_path)

View File

@@ -1,11 +1,12 @@
# Pip # Pip
from flask import Blueprint, current_app, render_template, send_from_directory from flask import Blueprint, current_app, render_template, send_from_directory
from jinja2 import TemplateNotFound
homescreen = Blueprint("homescreen", __name__, template_folder="templates") homescreen = Blueprint("homescreen", __name__, template_folder="templates")
@homescreen.route("/") @homescreen.route("/")
def show(): def index():
return render_template(f"index.html") return render_template(f"index.html")
@@ -14,3 +15,13 @@ def favicon():
return send_from_directory( return send_from_directory(
current_app.static_folder, "favicon.ico", mimetype="image/vnd.microsoft.icon" current_app.static_folder, "favicon.ico", mimetype="image/vnd.microsoft.icon"
) )
@homescreen.route("/", defaults={"page": "index"})
@homescreen.route("/<page>")
def show(page):
print(page)
try:
return render_template(f"{page}.html")
except TemplateNotFound:
abort(404)

View File

@@ -1,7 +1,13 @@
# Pip # Pip
from flask import Blueprint, render_template, request from flask import Blueprint, render_template, request
mainapp = Blueprint("mainapp", __name__, template_folder="templates", url_prefix="/app", static_folder="static") mainapp = Blueprint(
"mainapp",
__name__,
template_folder="templates",
url_prefix="/app",
static_folder="static",
)
@mainapp.route("/", methods=["GET", "POST"]) @mainapp.route("/", methods=["GET", "POST"])
@@ -18,7 +24,7 @@ def show():
print(deck_type, language, output_type) print(deck_type, language, output_type)
print() print()
state = "complete" state = "complete"
elif request.method == "POST": elif request.method == "POST":
state = "ready" state = "ready"
form = request.form.to_dict() form = request.form.to_dict()