Re: Chunked or streaming page output
On Thu, Mar 8, 2012 at 11:12 PM, Mike <geekademy@mgmiller.net> wrote:
> Hi,
>
> Wondering if the limitation (that a page must be completely built in memory
> before a response is sent) has been rememdied yet.
>
> Last mention I could find seems to be from almost four years ago:
> https://groups.google.com/d/topic/django-users/BJVZHuIBmSA/discussion
>
Depending on your needs, you can pass an iterator to HttpResponse in
order to generate chunks on the fly. This works for me using
apache/mod_fastcgi. Something like this:
def myview(request):
def inner():
yield "first chunk"
yield "second chunk"
return HttpResponse(inner())
Obviously this will not work if you require middleware that operates
over the entire response body.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home