开发者

Redirect realtime common line output to Django HttpResponse

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜