Celery is a popular distributed tasks queue. It is often used with Django framework to process heavy computational tasks in the background. You can add a single task to the queue or define periodic tasks. Periodic tasks are automatically scheduled for execution based on set time. The most common approach is to define the periodic tasks before the Celery worker is started. For example, it can be daily cleaning of the database. What if we would like to define periodic tasks dynamically? Recently, I’ve been working on a web app for uptime monitoring. The service continuously monitors a server and send email notification when the server is down. In the web app, the user can add a server address to be monitored and select the interval between requests to the server. How to dynamically add periodic tasks in Celery? I want to describe my approach in this article.
React and Django Free Boilerplate
Learn how to write SaaS application with React and Django from scratch
Contact us for any questions by filling a form.
Topic: Django-rest-framework
-
Dynamically update periodic tasks in Celery and Django
Celery Django-rest-framework Aleksandra Płońska, Piotr Płoński, October 17, 2022
-
Email Verification View in React for DRF backend
React Django-rest-framework Course Aleksandra Płońska, Piotr Płoński, October 06, 2022
After registration, a user will get an email with a verification link. Why is there such a procedure? We would like to have users with valid emails only to be able to contact them. (If we don’t care about emails, we could use the username for login)
-
Django Rest Framework Register New User with Email Verification
Django-rest-framework Course Aleksandra Płońska, Piotr Płoński, October 06, 2022
In this step, we will look closely at how the new user registration process looks and write a unit test for registration.
-
Django Rest Framework Email Verification
Django-rest-framework Backend Boilerplate Email Piotr Płoński, December 23, 2020
Email verification is an important part of the SaaS application. We will contact the user by email in many cases: for a password reset, announcement of new features, or for sending the invoice. During registration, a user provides the email address. We need to check if the email belongs to the user and that there are no typos/errors in it. This can be easily done by automatically sending the verification email with an activation link. Such a link contains the unique token assigned to the user. After opening the activation link in the web browser, the request is sent to the web application (Django Rest Framework). The web server compares the token from the activation URL with the token stored in the database. If they are the same, the email address is verified.
-
CRUD in Django Rest Framework and React
Django React Backend Frontend Django-rest-framework Boilerplate Piotr Płoński, October 29, 2020
In this artilce, we will create a CRUD (Create, Read, Update, Delete) model in the Django Rest Framework and React. It will be for simple note taking. User will be able to add new note, read all her notes, update note (to upper or lower case), and delete selected note.
-
Token Based Authentication with Django Rest Framework and Djoser
Django Django-rest-framework Token based authentication Djoser Backend Boilerplate Piotr Płoński, October 26, 2020
In this article, we will add token-based authentication REST API with Django Rest Framework and Djoser. The Django Rest Framework is a package for faster building REST APIs with Django. The Djoser provides basic views to handle authentication actions such as create user, login, logout.