Skip to content
This repository
Browse code

Documented send_from_directory

  • Loading branch information...
commit c34b03e9a677e467ea420d4286d4350ed429a4b8 1 parent ac13def
Armin Ronacher authored July 05, 2010
1  CHANGES
@@ -24,6 +24,7 @@ Codename to be decided, release date to be announced.
24 24
 - added support for per-package template and static-file directories.
25 25
 - removed support for `create_jinja_loader` which is no longer used
26 26
   in 0.5 due to the improved module support.
  27
+- added a helper function to expose files from any directory.
27 28
 
28 29
 Version 0.4
29 30
 -----------
2  docs/api.rst
Source Rendered
@@ -230,6 +230,8 @@ Useful Functions and Classes
230 230
 
231 231
 .. autofunction:: send_file
232 232
 
  233
+.. autofunction:: send_from_directory
  234
+
233 235
 .. autofunction:: escape
234 236
 
235 237
 .. autoclass:: Markup
9  flask/helpers.py
@@ -303,6 +303,15 @@ def download_file(filename):
303 303
             return send_from_directory(app.config['UPLOAD_FOLDER'],
304 304
                                        filename, as_attachment=True)
305 305
 
  306
+    .. admonition:: Sending files and Performance
  307
+
  308
+       It is strongly recommended to activate either `X-Sendfile` support in
  309
+       your webserver or (if no authentication happens) to tell the webserver
  310
+       to serve files for the given path on its own without calling into the
  311
+       web application for improved performance.
  312
+
  313
+    .. versionadded:: 0.5
  314
+
306 315
     :param directory: the directory where all the files are stored.
307 316
     :param filename: the filename relative to that directory to
308 317
                      download.

0 notes on commit c34b03e

Please sign in to comment.
Something went wrong with that request. Please try again.