Skip to content Skip to sidebar Skip to footer

Simultaneous Multitasking In Django

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

Solution 1:

The way to go is to use ztaskd to execute time_consuming_function().

from django_ztask.decorators import task

@task()
def time_consuming_function()
    ...

views.py:

defweb_function(request):
    ...
    time_consuming_function.async()
    return HttpResponse()

Solution 2:

I suggest you look at a task-scheduling framework, such as Celery (or just plain Rabbit MQ)

Post a Comment for "Simultaneous Multitasking In Django"