flask return html file code example
Example 1: flask make static directory
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route("/static/<path:path>")
def static_dir(path):
return send_from_directory("static", path)
if __name__ == "__main__":
app.run()
Example 2: flask return html
from flask import Flask, render_template
@app.route('/my_page')
def returnHTML():
return render_template('my_page.html')