Get variables parsed from Flask URL

Use request.view_args:

@app.context_processor
def provide_foo():
    if "post_id" in request.view_args:
        post_id = request.view_args["post_id"]
        return {"bar": some_function(post_id)}

Leave a Comment