Skip to content
Myr

No need for the directive here.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 79aa4ac · Browse files · 1 file+2 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−6 removed

  • other:+2 added−6 removed

1 file+2 added−6 removed

modified:docs/patterns/streaming.rst+2 added-6 removed
14 unmodified lines
15The trick is to have an inner function that uses a generator to generate16data and to then invoke that function and pass it to a response object17that has the ``direct_passthrough`` flag set. This flag is used to inform18the system that data is generated on the fly and should be passed through19without buffering:19without buffering::2021.. sourcecode:: python2221 from flask import Response2223 @app.route('/large.csv')24 def generate_large_csv():
11 unmodified lines
36------------------------3738The Jinja2 template engine also supports rendering templates piece by39piece. This functionality is not directly exposed by Flask because it is42quite uncommon, but you can easily do it yourself:40quite uncommon, but you can easily do it yourself::4144.. sourcecode:: python4542 from flask import Response4344 def stream_template(template_name, **context):45 app.update_template_context(context)
21 unmodified lines