I was trying to display the status of processing to the user on the front end when I was using StreamingHttpResponse.
I was able to get the current status but it is being appended to the previous one.
I want the response template to contain only the current yield.
views.py
from django.shortcuts import render
from django.http import StreamingHttpResponse,HttpResponse
import time
def f1():
x = 0
while x<5:
time.sleep(1)
x = x+1
code = """<p>{}</p>""".format(x)
yield code
def home(request):
return StreamingHttpResponse(f1())
output in the browser
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
expected output
1st: <p>1</p>
2nd: <p>2</p>
instead of <p>1</p><p>2</p>
3rd: <p>3</p>
instead of <p>1</p><p>2</p><p>3</p>
4th: <p>4</p>
instead of <p>1</p><p>2</p>3<p></p>4<p></p>
instead of appending the previous yield I want the template to be filled with the current yield.