Answers for "flask return html file"

0

flask return html

from flask import Flask, render_template

@app.route('/my_page')
def returnHTML():
    return render_template('my_page.html')
Posted by: Guest on January-23-2021
2

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()
Posted by: Guest on May-27-2020
0

how to return an html file in flask

from flask import Flask, render_template

app = Flask(__name__)
@app.route("/")
def index():
    return render_template('index.html') # You have to save the html files
                                         # inside of a 'templates' folder.
    
app.run(debug=True)
Posted by: Guest on September-29-2021

Python Answers by Framework

Browse Popular Code Answers by Language