On Wed, Oct 6, 2010 at 3:58 PM, Emil Stenström <e...@kth.se> wrote: > On Aug 24 2007, 8:18 pm, "Jeremy Dunck" <jdu...@gmail.com> wrote: >> >> On 8/24/07, whitesmell <jihua.p...@gmail.com> wrote: >> > One of my response content was build by several synchronous method, >> > how can Iflushmy response to client browser as soon as some part of >> > the response content is ready? >> >> The HttpResponse constructor takes either a string or an iterable. >> >> To trickle content down, you can make the iterable a generator. > > To reopen a really old thread: > > For performance reasons it might be a good idea to start sending HTML > to the client before the whole page has been rendered. For instance, > flushing directly after <head> makes sure new HTTP requests to linked > media (CSS and JS) gets requested while the rest of the page is > loaded. > > Now: Is there a nice way of doing this in Django?
Short answer: it's not well-supported. There are middleware which require access to the whole content (CSRF (possibly fixed now), GZip, etc.) I think people in Django core would like to better support it, but it's not an easy problem, because post-request cleanup depends on some signalling based on the response being complete. Please post to Django-dev if you'd like to discuss improving support. Related tickets: http://code.djangoproject.com/ticket/7581 http://code.djangoproject.com/ticket/13910 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.