How to access app.config in a blueprint?

前端 未结 7 981
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 23:07

I am trying to access access application configuration inside a blueprint authorisation.py which in a package api. I am initializing the blueprint in __in

7条回答
  •  误落风尘
    2020-12-12 23:36

    You could also wrap the blueprint in a function and pass the app as an argument:

    Blueprint:

    def get_blueprint(app):
        bp = Blueprint()
        return bp
    

    Main:

    from . import my_blueprint
    app.register_blueprint(my_blueprint.get_blueprint(app))
    

提交回复
热议问题