Using parameters in Flask url

Question:

Is it possible to put PATH like this text/text.txt into URL parameter in Flask ?
It is important that it contains PATH with slash and dot.

@app.route('/<path>')
def getPath(path):
    return path
Asked By: wondergrandma

||

Answers:

If you use variable rules with the prefix path your requirements should be met.

@app.route('/<path:filename>')
def getPath(filename):
    return filename
Answered By: Detlef
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.