The Definitive Guide to Celery and Flask
- Updated January 5th, 2022
In this course, you will learn how to add Celery to a Flask application, allowing you to handle asynchronous tasks, which is vital for smooth user experiences. With this powerful combo, you will be able to do things like:
- Run machine learning models
- Send bulk emails
- Process images or PDFs
- Generate exports of user data
- Perform backups
These functions are increasingly common in modern web applications, but with Celery they are easy to implement. Because so many of these activities may be critical to the operation of your application, this course will walk you through configuring, testing, deploying, and monitoring of Celery tasks. With this setup, you can be assured that your tasks are firing and working as expected, outside the HTTP request/response flow.
What will you learn?
Select a Part
In this first part, you'll learn how to configure Celery to work with Flask and Docker in order to process tasks in the background asynchronously. We'll then look at how to retry failed tasks, debug tasks, and ensure tasks work with SQLAlchemy database transactions correctly. Finally, we'll add WebSocket support to Flask with Flask-Socket.IO.
- Containerize Flask, Celery, and Redis with Docker
- Ensure Celery tasks execute correctly with validation and debugging
- Create and manage Celery tasks
- Use Flask-Socket.IO and Eventlet to add WebSocket support to a Flask application
In part 2, we'll dive into testing with pytest. We'll also look at a Test-Driven Development (TDD) workflow. You'll then deploy the application to DigitalOcean and learn how to properly monitor Celery tasks with Flower, Container Advisor, and Prometheus. Finally, we'll look at some Celery best practices and tips for performance tuning.
- Set up logging with Papertrail
- Practice Test-Driven Development
- Deploy Flask, Celery, and RabbitMQ to DigitalOcean
- Configure monitoring
What do you need to know?
This course is targeted at advanced-beginners -- someone with at least 6 months of web development experience. Before beginning, you should have some familiarity with the following topics:
What developers are saying
I'm loving The Definitive Guide to Celery and Flask course. It's honestly one of the best quality courses I've followed. I really like the format, level of detail, and the fact that it's kept up-to-date.
The TestDriven.io courses are some of the best courses I've ever done for any language, any platform, any price range... just some of the most thorough and well-sourced courses around.
Just a word of thanks for doing such a great job with these training courses. The thorough, entire-lifecycle approach -- from implementation through test, coverage, quality, CI/CD, and all the rest -- is what separates these courses from other training material that I've completed. I'll be able to walk away from here with knowledge and skills that I can apply immediately at work -- and for that I'm grateful. It's a rare gift in an environment where so much 'training' is really just lightweight treatment that doesn't begin to scratch the surface of real, end-to-end software development. Really well done!
The TestDriven.io courses are worth 10 times what I paid for them.
I am very much into buying and purchasing any course by you and your team. I've never felt like a better programmer ready to show my coding chops to the world.
Frequently Asked Questions
What tools and technologies are used in this course?
This course covers a variety of technologies and services:
Testing and Monitoring
- Container Advisor
What can I learn to build with Flask and Celery?
Celery is perfect for managing background and periodic tasks. In Flask applications, it's commonly used for:
- Performing long running tasks, like processing image uploads such as cropping, resizing, compressing, or building various thumbnails.
- Similarly, generating PDFs of large datasets, perhaps as part of an export.
- Sending bulk emails to users, perhaps as part of a mailing list, email-based game, or facilitating redundancy in forum software.
- Performing tasks on a schedule, such as a regular backups, generating activity digests, or scraping web content during low traffic periods.
Celery is a must-have for many Flask web applications because of these common use cases.
What support does TestDriven.io offer?
Since the courses mimic real-world development, support is provided via Stack Overflow. Helpful users, including the developers of the courses, read and respond to messages on Stack Overflow. If you get stuck and you can't find an answer via Stack Overflow, feel free to reach out via email directly. Just be sure to detail what you've tried. For more, review Support and Consulting.
How long does it take to complete the course?
It's dependent on your current skill level. On average, it takes approximately 12 hours to complete.