In a long run command line execution, like uncompressing a large .zip archive, how to redirect the realtime output of unzip command to browser via Django's HttpResponse?
EDIT: According to paul's suggestion, I did a search and found this question h开发者_运维百科as answers to how to return a HttpResponse by using a generator.
Update HttpResponse Every Few Seconds
Now, remaining problem is how to capture and create a generator from the output of unzip.
The HttpResponse constructor takes either a string or an iterable.
To trickle content down, you can make the iterable a generator.
Provided, of course, your middleware isn't interfering.
精彩评论