Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
本例中的代码:
posts.add_url_rule('/', view_func=ListView.as_view('list')) posts.add_url_rule('/<slug>/', view_func=DetailView.as_view('detail'))
没看懂上面函数中传入的参数,这里as_view的目的是什么?listdetail
as_view
list
detail
它为路由系统创建端点,因此您可以使用url_for('posts.list')或类似的API 文档在这里。
url_for('posts.list')