Nani
Nani

Reputation: 5

Django request should run in background?

When user submit request, the request should run in background so that user should not wait for the request complete and update to user via email/slack channel?

i have a request to ssh and performs the task, so some commands/tasks will take longer time to completed, that's why i'm looking this option

What is the better way to achieve?

Upvotes: 0

Views: 96

Answers (1)

KARTIK CHOUDHARY
KARTIK CHOUDHARY

Reputation: 61

For django you can use Celery with rabbitmq or reddis for achieving the asynchronous programming in that way user will not have to wait for them to be complete using celery you have to turn that email sending function in a task and call that function in view with email_function.delay(*args) you can refer this link for celery documentation https://docs.celeryproject.org/en/stable/django/first-steps-with-django.html

Upvotes: 1

Related Questions