开发者

Asynchronous database update in Django?

开发者 https://www.devze.com 2022-12-26 18:03 出处:网络
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 th

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开发者_Go百科 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号