Asynchronous tasks with Celery

Celery is a library that allows you to run asynchronous tasks within Python. This is especially helpful in Python as Python runs single threaded and you may find that you have a long-running task that you wish to either start and discard; or you may wish to give the user of your website some feedback on the progress of the said task.

One such example is e-mail. A user may request an e-mail to be sent, for example a password reset request, and you don't want them waiting for the page to load while the e-mail is generated and sent. We can set this up as a start and discard operation and let the user know that the request is being dealt with.

The way Celery is able to escape the single-threaded environment of Python is ...

Get Learning Flask Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.