flask 是否总是默认为 index.html 作为根模板目录中的 index.html?我有一个命名模板文件夹的蓝图,在该模板文件夹中我有一个名为 index.html 的文件。但是,我在项目结构的根目录中也有一个 index.html 作为主要登录页面。 Flask 呈现根目录 index.html 与模板文件夹中的 index.html。为什么?什么是解决方法?重命名整个项目只有1个index.html?
from flask import Blueprint, render_template
foodtracker = Blueprint('foodtracker', __name__, template_folder='foodtemplates')
@foodtracker.route('/foods')
def foodsindex():
return render_template('index.html')