everyone!
I got an problem while i was using jinja2 url_for() function.
I have a route like:
@app.route('/article/<int:article_id>/<url_title>/', methods=['GET'])
def article_page(article_id, url_title):
article = Article.query.get(article_id)
if article == None:
abort(404)
return render_template('article.html', article=article)
in jinja template file,i want to create a url which links to article_page,so i write like this:
<h5><a href="{{ url_for('article_page',article_id=article.id,url_title=article.url_title) }}">{{ article.title }}</a></h5>
but when i run this page,i get a error:
raise BuildError(endpoint, values, method)
BuildError: ('article_page', {'article_id': 1}, None)
seems like that the second parameter 'url_title' missing. How can I use url_for() with multiple parameters correctly? Thanks everyone!