在博客网址中使用帖子标题

时间:2019-02-10 17:41:05

标签: python web url flask blogs

@posts.route("/post/<int:post_id>")
def post(post_id):
    post = Post.query.get_or_404(post_id)
    return render_template('post.html', title=post.title, post=post)

这是输出URL

/post/12

但是我想要这样的东西

/post/12/test-user-post

0 个答案:

没有答案
相关问题