* ui_ux: => 0
* easy: => 0
Comment:
Being able to stream a template alone would be useful, even without being
able to stream a HTTP response. I'm thinking of using a template to
generate a large amount of data (XML?), and wanting to stream that to disk
versus read it all into memory first.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: mindsocket (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:10>
Comment (by mindsocket):
I'm hoping to revisit this ticket, are there any updates or others working
on it already? If not, any changes since 1.5 that might influence how it
should be implemented?
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:12>
Comment (by mindsocket):
I've put my work in progress in a branch:
https://github.com/mindsocket/django/tree/t13910
So far I've taken rooney's patch and updated it to work with current
development. The template_tests pass, but some others are failing, and new
tests are needed for the new streaming code.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:13>
Comment (by charettes):
1.5 introduced [https://docs.djangoproject.com/en/1.5/releases/1.5
/#explicit-support-for-streaming-responses StreamingHttpResponse].
There's already a
[https://github.com/django/django/blob/4d817b38875c900d70793acd528afc9e954bbcb7/django/template/response.py
TemplateResponse]. Maybe you can start your work by providing a
`StreamingTemplateResponse`?
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:14>
Comment (by mindsocket):
Thanks charettes. I've updated my branch to improve on what I had
(including correct use of a StreamingHttpResponse and new unit tests), but
I will have a look at TemplateResponse now too.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:15>
Comment (by mindsocket):
I've now added a StreamingTemplateResponse and StreamingTemplateView that
build upon the earlier work to introduce generator based rendering of
templates.
I've tried to include new tests where possible, but feedback about where
they're lacking is most welcome.
https://github.com/mindsocket/django/tree/t13910
Some background to explain my interest in this ticket, I created a sample
app that makes use of the template streaming in this branch.
It's an experimental proof of concept that uses a middleware to start
sending back HTML before even calling the view.
Code: https://github.com/mindsocket/django-perf-
example/blob/master/perf_example/views.py
Results:
http://www.webpagetest.org/video/compare.php?tests=130428_WX_F4V-l:eager_streaming%2C130428_W6_F42-l:streaming%2C130428_3X_F4E-l:original&thumbSize=200&ival=500&end=doc
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:16>
* version: 1.2 => master
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:17>
* cc: selwin (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:18>
Comment (by mindsocket):
Having given this patch more of a workout I've since fixed a test bug and
created a pull request...
https://github.com/django/django/pull/1037
My only concern about the commit is whether more documentation updates are
needed for aspects higher up the stack, like StreamingTemplateView. I'm
not entirely sure how I'd go about explaining the benefits, specific use
cases and most importantly downsides (like exception handling) of
streaming without lots of hand waving.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:19>
* status: new => assigned
* owner: nobody => mindsocket
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:20>
Comment (by anonymous):
I love this feature. What's the status?
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:21>
Comment (by bmispelon):
Replying to [comment:21 anonymous]:
> I love this feature. What's the status?
For one thing, the provided pull request no longer applies cleanly on
master so it needs to be brought back up to date.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:22>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:23>
* owner: mindsocket => Gagaro
* needs_docs: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:24>
Comment (by Gagaro):
New pull request: https://github.com/django/django/pull/4783
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:25>
* cc: Gagaro (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:26>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:27>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:28>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:29>
* needs_better_patch: 0 => 1
Comment:
Aymeric [https://groups.google.com/d/msg/django-
developers/kuGeu7ffJsc/QDkZxoAbDwAJ raised some questions/concerns] about
the proposed APIs on django-developers.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:30>
* needs_better_patch: 1 => 0
Comment:
Patch has been updated to address the API concerns.
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:31>
* needs_better_patch: 0 => 1
Comment:
Marking as "Patch needs improvement" given
[https://github.com/django/django/pull/4783#issuecomment-149877143 the
latest comment about a regression in performance].
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:32>
* cc: binary@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:33>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:34>
* cc: Petr Glotov (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:35>
* owner: Gagaro => Petr Glotov
Comment:
[https://github.com/django/django/pull/11157 New PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:36>
* needs_better_patch: 0 => 1
Comment:
Patch includes changes to shortcuts, generic views and so-on, which are of
questionable value, and out-of-scope for this ticket. Needs stripping down
to just allowing a `render()` to return a generator, but should be good.
[https://github.com/django/django/pull/11157#pullrequestreview-262400485
Comments on PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:37>