How to display the progress of a function in an html page Django?

I'm learning Django, tell me if it's possible to implement my idea.

In the file views.py I have a script

def index(request):
    ....
    for i in range(100000):
        print(i)
    return render(request, 'main/index.html', {'title': 'Website main page', 'tasks': ...})

How can I display these prints in the index.html page? If I insert the variable i into render, then the page is in the process of waiting and, as a result, shows only the last value in the iteration. I understand why this is happening. But how can I then display online in the process - what happens in the terminal, all the values ​​in the enumeration?

It seems to me that javascirpt is needed for this - I think or is it possible to display this in a simpler way?

Вернуться на верх