title: How to do pagination in flask
body: <pre><code>**python code:** 
  
  from flask import Flask, render_template, request, redirect, url_for, session ,flash
  from flask_mysqldb import MySQL
  import MySQLdb.cursors
  import re
  app = Flask(__name__)
  
  app.secret_key = 'your secret key'
  
  app.config['MYSQL_HOST'] = 'localhost'
  app.config['MYSQL_USER'] = 'root'
  app.config['MYSQL_PASSWORD'] = ''
  app.config['MYSQL_DB'] = 'details'
  
  mysql = MySQL(app)
  
  @app.route('/home')
  def home():
      if 'loggedin' in session:
          cur = mysql.connection.cursor()
          cur.execute(&quot;SELECT  * FROM ml_process_status&quot;)
          data = cur.fetchall()
  
          return render_template('home.html', username=session['username'], items=data)
  
      return redirect(url_for('login'))
  </code></pre>
  <p>There are 50 rows in phpmyadmin mysql database. Is there any solution to show only 10 rows in first page and next 10 rows in other pages. I have select * query to show all the rows in the page</p>