P
P
Pavel2018-01-08 19:15:38
Flask
Pavel, 2018-01-08 19:15:38

How to generate a link relative to the current path in flask?

There is a function with a route

@app.route("/", defaults={'path': ''},methods=['GET'])
@app.route("/<path:path>",methods=['GET'])
def index(path)


In the template I do url_for('index', path=path) , which naturally leads to the fact that links are created with a path only relative to the base link. How can I make it so that the current path is also taken into account?
Link example test.ru/test/test2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
artem78, 2018-01-08
@rusbaron

https://stackoverflow.com/a/21498733/4108542

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question