First, we must define our task module
tasks.py inside the server. Let's check the description of the
tasks.py module. In the following chunk of code, we have imports necessary for our function that will calculate the square root:
from math import sqrt from celery import Celery
Now, let's create the following instance of Celery, which will represent our client application:
app = Celery('tasks', broker='redis://192.168.25.21:6379/0')
We have created an instance of Celery that will control some aspects of our application. Notice that in its initializer, we informed the name of the module in which definitions of the task are present and we stated the address of the broker as a second argument.
Then, we have to set up our result backend, which will also be in Redis, as follows:
app.config.CELERY_RESULT_BACKEND = 'redis://192.168.25...