Flask URL Variables


Flask supports URL variables with the route decorator.

Type Description
string (Default) Accepts any text without slashes
int Accepts positive integers
path Similar to string, but also accepts slashes
uuid Accepts UUID strings

👇

@users_blueprint.route('/<int:id>')
def get_user(id):
    return f'<h2>Data for user #{id}</h2>'