mpen
mpen

Reputation: 282805

Asynchronous database update in Django?

I have a big form on my site. When the users fill it out and submit it, most of the data just gets dumped to the database, and then they get redirected to a new page. However, I'd also like to use the data to query another site, and then parse the results. That might take a bit longer. It's not essential that the user sees these results right away, so I was wondering if it's possible to asynchronously call a function that will handle this, and then return an HttpResponse from my view like usual without making them wait?

If so... how? Any particular libraries I should look at?

Upvotes: 0

Views: 1508

Answers (1)

lprsd
lprsd

Reputation: 87077

User RabbitMQ and Celery with django. If you are deployed on EC2, also look at SQS

You create a message from the request-response cycle and an alternative process or a cron keeps checking off the messages.

Upvotes: 3

Related Questions