|
@@ -84,18 +84,20 @@ for Celery. This means that you don't have to use multiple
|
|
configuration files, and instead configure Celery directly
|
|
configuration files, and instead configure Celery directly
|
|
from the Django settings; but you can also separate them if wanted.
|
|
from the Django settings; but you can also separate them if wanted.
|
|
|
|
|
|
|
|
+.. code-block:: python
|
|
|
|
+
|
|
|
|
+ app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
|
|
+
|
|
The uppercase name-space means that all Celery configuration options
|
|
The uppercase name-space means that all Celery configuration options
|
|
must be specified in uppercase instead of lowercase, and start with
|
|
must be specified in uppercase instead of lowercase, and start with
|
|
``CELERY_``, so for example the :setting:`task_always_eager` setting
|
|
``CELERY_``, so for example the :setting:`task_always_eager` setting
|
|
becomes ``CELERY_TASK_ALWAYS_EAGER``, and the :setting:`broker_url`
|
|
becomes ``CELERY_TASK_ALWAYS_EAGER``, and the :setting:`broker_url`
|
|
setting becomes ``CELERY_BROKER_URL``.
|
|
setting becomes ``CELERY_BROKER_URL``.
|
|
|
|
|
|
-You can pass the object directly here, but using a string is better since
|
|
|
|
-then the worker doesn't have to serialize the object.
|
|
|
|
-
|
|
|
|
-.. code-block:: python
|
|
|
|
-
|
|
|
|
- app.config_from_object('django.conf:settings', namespace='CELERY')
|
|
|
|
|
|
+You can pass the settings object directly instead, but using a string
|
|
|
|
+is better since then the worker doesn't have to serialize the object.
|
|
|
|
+The ``CELERY_`` namespace is also optional, but recommended (to
|
|
|
|
+prevent overlap with other Django settings).
|
|
|
|
|
|
Next, a common practice for reusable apps is to define all tasks
|
|
Next, a common practice for reusable apps is to define all tasks
|
|
in a separate ``tasks.py`` module, and Celery does have a way to
|
|
in a separate ``tasks.py`` module, and Celery does have a way to
|