'render a template and Keep running another background task in Django
I would line to run a function without interrupting the current function as follows
def taskone(request):
#processes of task one
tasktwo()
return render(request,"index.html")
As taskone executes, tasktwo should also start executing. Task one should allow task two to continue executing in the background as it renders the html page.
Please someone give me an idea on how to go about it.
Solution 1:[1]
I would recommend you the django-after-response. This is much easier to set up than celery also less process-heavy. Only use celery if you need something complex like scheduling tasks, running multiple queues, etc.
The project does not have much documentation. You can find the docs in git repo itself - https://github.com/defrex/django-after-response
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
