Reputation: 17881
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 has 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.
Upvotes: 4
Views: 840
Reputation: 20107
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.
Upvotes: 1