草庐IT

python - Flask、蓝图、current_app

我正在尝试从蓝图(我将在模板中使用的函数)在Jinja环境中添加一个函数。主.pyapp=Flask(__name__)app.register_blueprint(heysyni)MyBluePrint.pyheysyni=Blueprint('heysyni',__name__)@heysyni.route('/heysyni'):returnrender_template('heysyni.html',heysini=res_heysini)现在在MyBluePrint.py中,我想添加如下内容:defrole_function():return'admin'app.jinja_