Jun-22-2019, 12:30 PM
On the server have a list,send list to html template.
In html template loop over list with jinja.
server:
In html template loop over list with jinja.
server:
from flask import Flask, render_template, jsonify app = Flask(__name__) @app.route('/') def bar(): lst = ["Python", 'HTML', 'JavaScript'] return render_template("index_page.html", lst=lst) if __name__ == '__main__': app.run(debug=True)index_page.html:
<!doctype html> <html> <head> <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/style.css') }}" /> </head> <body> <p>Navigation pagination:</p> <div class="pagination"> <ul> <a href="#" class="active">Home</a> {% for page in lst %} <a href="#">{{ page }}</a> {% endfor %} </ul> </div> </body> </html>