Ask Solem 3a07d82091 Django users do not have to type in DJANGO_SETTINGS_MODULE when using the celery command 11 năm trước cách đây
..
demoapp e650e3b774 flakes 11 năm trước cách đây
proj 3a07d82091 Django users do not have to type in DJANGO_SETTINGS_MODULE when using the celery command 11 năm trước cách đây
README.rst 5c50200df8 Django example: Celery app defined in projects main reusable app instead of a separate tasks django app 11 năm trước cách đây
manage.py 40aadcb9b4 Move Django example one dir below 12 năm trước cách đây

README.rst

==============================================================
Example Django project using Celery
==============================================================

Contents
========

``proj/``
---------

This is the project iself, created using
``django-admin.py startproject proj``, and then the settings module
(``proj/settings.py``) was modified to add ``demoapp`` to
``INSTALLED_APPS``

``proj/celery.py``
----------

This module contains the Celery application instance for this project,
we take configuration from Django settings and use ``autodiscover_tasks`` to
find task modules inside all packages listed in ``INSTALLED_APPS``.

``demoapp/``
------------

Example generic app. This is decoupled from the rest of the project by using
the ``@shared_task`` decorator. This decorator returns a proxy that always
points to the currently active Celery instance.


Starting the worker
===================

The ``DJANGO_SETTINGS_MODULE`` environment must be set when starting the
worker:

.. code-block:: bash

$ DJANGO_SETTINGS_MODULE='proj.settings' celery -A proj worker -l info