Instead of typing our HTML markup into the return statements, we can use the render_template() function:
render_template()
from flask import Flask from flask import render_template app = Flask(__name__) @app.route("/about") def about(): return render_template("about-us.html") if __name__ == "__main__": app.run(host="0.0.0.0", port=80, debug=True)
This will use our template file about-us.html. To ensure our application can find this file we must organize our directory in the following format:
about-us.html
- application.py /templates - about-us.html - login-form.html /static /styles - about-style.css - login-style.css /scripts - about-script.js - login-script.js
Read Articlehttps://develop.horje.com/learn/1434/reference