Php – Is there a PHP flush() like function in Django/Python that allows me to send a partial HTTP response to the client?

Is there a PHP flush() like function in Django/Python that allows me to send a partial HTTP response to the client?… here is a solution to the problem.

Is there a PHP flush() like function in Django/Python that allows me to send a partial HTTP response to the client?

According to performance tip from Yahoo

:

When users request a page, it can take
anywhere from 200 to 500ms for the
backend server to stitch together the
HTML page. During this time, the
browser is idle as it waits for the
data to arrive. In PHP you have the
function flush(). It allows you to
send your partially ready HTML
response to the browser so that the
browser can start fetching components
while your backend is busy with the
rest of the HTML page.

Example:

   ... <!-- css, js -->
    </head>
    <?php flush(); ?>
    <body>
      ... <!-- content -->

Is there a flush() function in Django/Python similar to PHP?

Thanks

Solution

No. is a short answer.

The long answer depends on what you are using between the web server and Python:
You can use WSGI to achieve it, but it’s not a whimsical task.

Maybe start here?
http://www.python.org/dev/peps/pep-0333/#the-start-response-callable

Related Problems and Solutions