Is there any clever solution to store static files in Flask\'s application root directory. robots.txt and sitemap.xml are expected to be found in /, so my idea was to create
This might have been added since this question was asked, but I was looking through flask's "helpers.py" and I found flask.send_from_directory:
send_from_directory(directory, filename, **options)
'''
send_from_directory(directory, filename, **options)
Send a file from a given directory with send_file. This
is a secure way to quickly expose static files from an upload folder
or something similar.
'''
... which references flask.send_file:
send_file(filename_or_fp, mimetype=None, as_attachment=False, attachment_filename=None, add_etags=True, cache_timeout=43200, conditional=False)
... which seems better for more control, although send_from_directory passes **options directly through to send_file.