Before_request for multiple Blueprints

flask, python

Solution

use `blueprint.before_app_request` which applies to views app-wide, not only views in the same blueprint

Problem

Here's my situation: Let's say I have 2 Blueprints before_request method: ``` mod = Blueprint('posts', __name__, url_prefix='/posts') @mod.before_request def before_request(): #some code that uses SQLAlchemy here pass ``` Now I don't want to duplicate the logic in this method in the second blueprint. How can I do this? PS: I'm new to Python so I might be missing something obvious. Thanks.

Original source