This article is mainly for everyone to introduce the Python flask to achieve paging effect, with a certain reference value, interested in small partners can refer to
In the course of our study will encounter such a problem, that is, in the course of our study will find the need for paging processing, here, to introduce you to the page of the book said.
@app. Route ('/', methods=[' GET ') @app. Route ('/<int:page> ') def Home (page=1): pagination=post.query.order _by (Post.publish_date.desc ()). Paginate (page, per_page=10,error_out=false) posts = pagination.items link, Tuijian_post,fenlei=get_tui_link () return render_template (' home1.html ', posts=posts, pagination= Pagination, Tuijian_post=tuijian_post,fenleis=fenlei, links=link)
This is the paging data I read from the database, so how do we split the page, and we'll see what the book says.
Then we need to take a separate page to save our paging related,.
So how do we use it?
{% import "mac.html" as Macros%}
After our loop, add the following
Effect