You want to serve a static HTML file named index.html from your Flask app on Raspberry Pi when users visit /. Which code snippet correctly does this?
Afrom flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/')
def home():
return send_from_directory('static', 'index.html')
Bfrom flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return 'index.html'
Cfrom flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return open('static/index.html').read()
Dfrom flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')