Get route value from inside a decorator
问题 In Flask, how do you get a route value (eg. '/admin') inside a decorator? I need to pass certain string to the DB depending on which route was used (and they all use the same decorator). @app.route('/admin') @decorator def admin(data): do_something(data) I couldn't find information about how to do it in Python. Is it possible? 回答1: You can define a new decorator which get the current route path then do something with it: from functools import wraps from flask import request def do_st_with