Flask blueprint how do multiple routes use the same before_request method?

I have registered multiple routes using the blueprint. For example, @ admin.route and @ home.route, now define a before_request method, which I used in @ admin.before_request, and now I want to use it in @ home. What should I do? You don"t have to redefine this method in every file, do you?

Oct.15,2021

before_request is defined by you, right? Use different blueprints of before_request to decorate this function (you can call it by defining two functions, and then home.before_request and admin.before_request modify two functions respectively)


before_request the method requires you to redefine it in a different blueprint.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3236b-4d495.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3236b-4d495.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?