📅  最后修改于: 2022-03-11 14:46:33.189000             🧑  作者: Mango
from flask import Blueprint, render_template, abort
from jinja2 import TemplateNotFound
simple_page = Blueprint('simple_page', __name__,
template_folder='templates')
@simple_page.route('/', defaults={'page': 'index'})
@simple_page.route('/')
def show(page):
try:
return render_template(f'pages/{page}.html')
except TemplateNotFound:
abort(404)