flask.send_from_directory(directory, filename, **options)[source]

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.

Example usage:

@app.route('/uploads/<path:filename>')

It is strongly recommended to activate either X-Sendfile support in your webserver or (if no authentication happens) to tell the webserver to serve files for the given path on its own without calling into the web application for improved performance.
Parameters: directory – the directory where all the files are stored. filename – the filename relative to that directory to download. options – optional keyword arguments that are directly forwarded to send_file().