views:

178

answers:

1

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.

http://stackoverflow.com/questions/1754922/update-httpresponse-every-few-seconds

Now, remaining problem is how to capture and create a generator from the output of unzip.

+1  A: 

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.

Paul McMillan