Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To create a local configuration file for celery daemon in production environment without using Django, you can follow these steps:

  1. Create a configuration file: Create a file named 'celeryconfig.py' in your project directory. This file will contain the configuration options for the Celery daemon.

  2. Set the broker URL: Set the 'BROKER_URL' variable in the configuration file to the URL of your message broker. For example, if you are using RabbitMQ, the URL will be something like 'amqp://guest:guest@localhost:5672/'.

  3. Configure the task result backend: Set the 'CELERYRESULTBACKEND' variable to the URL of your task result backend. For example, if you are using Redis, the URL will be something like 'redis://localhost:6379/0'.

  4. Set the task time limit: Set the 'CELERYDTASKSOFTTIMELIMIT' and 'CELERYDTASKTIME_LIMIT' variables to specify the maximum time a task can run before it is terminated.

  5. Set the concurrency level: Set the 'CELERYD_CONCURRENCY' variable to specify the number of worker processes to run.

  6. Set the log level: Set the 'CELERYDLOGLEVEL' variable to specify the log level for the daemon.

  7. Start the celery daemon: Start the Celery daemon by running the command 'celery worker -A <module_name> -c <concurrency_level>', where '<module_name>' is the name of the Python module that contains the Celery app, and '<concurrency_level>' is the number of worker processes to run.

  8. Verify the configuration: Verify that the Celery daemon is running correctly by executing some tasks and checking their results.

By following the above steps, you can create a local configuration file for the Celery daemon in your production environment without using Django.