How to access app.config in a blueprint?

前端 未结 7 963
没有蜡笔的小新
没有蜡笔的小新 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:59

    The current_app approach is fine but you must have some request context. If you don't have one (some pre-work like testing, e.g.) you'd better place

    with app.test_request_context('/'):

    before this current_app call.

    You will have RuntimeError: working outside of application context , instead.

    0 讨论(0)
提交回复
热议问题