As stated before, Celery tasks are just user-defined functions that perform some operations. But before any tasks can be written, our Celery object needs to be created. This is the object that the Celery server will import to handle running and scheduling all of the tasks.
At a bare minimum, Celery needs one configuration variable to run, and that is the connection to the message broker. The connection is defined the same as the SQLAlchemy connection; that is, as a URL. The backend, which stores our tasks' results, is also defined as a URL, as shown in the following code:
class DevConfig(Config): DEBUG = True SQLALCHEMY_DATABASE_URI = 'sqlite:///../database.db' CELERY_BROKER_URL = "amqp://rabbitmq:rabbitmq@localhost//" CELERY_RESULT_BACKEND = "amqp://rabbitmq:rabitmq@localhost//"
In the __init__.py...