I'm new to Flask and have started messing around with it recently. I've seen about a half-dozen or so different answers and ways to achieve similar results.
I'm hosting the robots.txt in the static folder, but wondering if this is the best solution for the environment here. Any advice? Is there something I should do differently?
from flask import Flask, send_from_directory, request
app = Flask(__name__, static_folder='static')
# other code
@app.route('/robots.txt')
def static_from_root():
return send_from_directory(app.static_folder, request.path[1:])