diff --git a/CHANGES b/CHANGES index 32f889a3..10ed8e9c 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ Codename to be decided, release date to be announced. - added support for per-package template and static-file directories. - removed support for `create_jinja_loader` which is no longer used in 0.5 due to the improved module support. +- added a helper function to expose files from any directory. Version 0.4 ----------- diff --git a/docs/api.rst b/docs/api.rst index b6c81d10..d7f887e4 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -230,6 +230,8 @@ Useful Functions and Classes .. autofunction:: send_file +.. autofunction:: send_from_directory + .. autofunction:: escape .. autoclass:: Markup diff --git a/flask/helpers.py b/flask/helpers.py index 65506698..560492c6 100644 --- a/flask/helpers.py +++ b/flask/helpers.py @@ -303,6 +303,15 @@ def send_from_directory(directory, filename, **options): return send_from_directory(app.config['UPLOAD_FOLDER'], filename, as_attachment=True) + .. admonition:: Sending files and Performance + + 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. + + .. versionadded:: 0.5 + :param directory: the directory where all the files are stored. :param filename: the filename relative to that directory to download.