Flask, url dynamic nav

I am trying to get my Flask urls to work, currently, I have this navigation:

@app.route("/<category>")
def category(category):

@app.route("/<category>/<subcategory>")
def subcategory(category, subcategory):

The idea is that one would navigate, from one category to another etc. Also, support e.g.: health/fasting/fasting-is-good-for-you

But, I cannot seem to get the url_for() to work, what am I doing wrong, any help is appreciated. Thanks a lot in advance!

EDIT: I keep getting the following error: "werkzeug.routing.BuildError

werkzeug.routing.BuildError: Could not build url for endpoint ‘category’. Did you forget to specify values [‘category’]? "

Tried:

<a href="{{url_for('category')}}/{{url_for('subcategory')}}/{{slug}}">

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.