Streaming HTTP response, flushing to the browser

前端 未结 1 1828
情书的邮戳
情书的邮戳 2021-02-08 23:08

I\'ve got a view like the following:

from django.views.decorators.http import condition

def stream():
    for i in range(0, 40):
        yield \" \" * 1024
             


        
相关标签:
1条回答
  • 2021-02-08 23:34

    To make http streaming work, your middleware, WSGI container, and web server (as well as the reverse-proxy/load-balancer if you use an nginx+apache2 syle deployment) all have to support it. Disable the middleware and remove some of the layers until it works (anything that does caching or sets etags is out), then add them back. I don't know what stack you have, but IIRC apache2 + mod_python is OK with streaming, though it's not the recommended way to serve Django.

    0 讨论(0)
提交回复
热议问题