I have a google verification file that I need to have in my root directory. How do I serve it and set up the route correctly in my app.py file? I thought just having it in the static directory would do the trick.
In my app.py file:
import requests; requests = requests.session() from flask import ( Flask, g, session, request, render_template, abort, json, jsonify, make_response ) from jinja2 import TemplateNotFound app = Flask(__name__) ...
@app.route('/ping') def ping(): return "OK" """ Catch-All Route first looks for templates in /templates/pages then looks in /templates finally renders 404.html with 404 status """ @app.route('/', defaults={'path': 'index'}) @app.route('/<path:path>') def show_page(path): if session.get('tracking_url'): session['session_url'] = False templates = [t.format(path=path) for t in 'pages/{path}.html', '{path}.html'] g.path = path try: return render_template(templates, **site_variables(path)) except TemplateNotFound: return render_template('404.html', **site_variables(path)), 404 application = app if __name__ == '__main__': app.run('0.0.0.0', debug=True) I've tried adding this but it didn't work:
@app.route('/myfile.html') def myfile(): return send_from_directory('/static', 'myfile.html')
/staticroute however.staticfiles to be found./static/...will be checked before this catch-all route.