this is a different aproach for the question I already asked
Simultaneous multitasking in Django
so it will share the intro.
I have in my web project a time consuming function. While the function is doing its computations, a web page should be rendered informing the user that the results will be sent by email once the computation is done.
views.py:
def web_function(request):
...
return HttpResponse(results_will_be_sent_by_mail.html)
time_consuming_function()
Since the page that has to be rendered is quite simple, and it requires no return information from time_consuming_function() is there a way to skip multitasking and just somehow first render and show the page and than call time_consuming_function()?
Possible solution:
- When the input button is pressed on the page that precedes the calling of "web_function", attach some javascript code which will render the temporary page?
Update
Ended up using celery. Wasn't successful in experimenting with Ajax.
request_finishedsignal? However, I'm not sure it is raised before/after sending the response. docs.djangoproject.com/en/dev/ref/signals/#request-finished