为什么flask 渲染错误的模板

时间:2021-06-07 22:03:39

标签: python flask

UI = Blueprint('UI', __name__, static_folder='static', static_url_path='/static/UI', template_folder='templates')

web = Blueprint('web', __name__, static_folder='static', static_url_path='/static/web', template_folder='templates')

我的项目使用两个不同的蓝图,它们使用不同的模板,应用程序文件夹中每个蓝图都有两个子文件夹(UIweb),每个子文件夹都有两个文件夹(static、{ {1}}),

templates

当我尝试访问 @UI.route('/dashboard', methods=['GET', 'POST']) def login(): usr = Admin.query.filter_by(username="admin").first() if not usr: if request.method == "POST": if 'passwrd' in request.form: # irrelevant code goes here return render_template('create_password.html') ## this will be triggered if admin is Found if request.method == 'POST': if request.form['passwrd']: ### irrelevant code goes here return render_template('Alogin.html') 时,会呈现 127.0.0.1:5000/dashboard 蓝图中的模板

我尝试更改 web 参数,但仍然呈现错误的模板

0 个答案:

没有答案