Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create getting_started.rst #328

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Getting started
===============

To use :pypi:`django-celery-results` with your project you need to follow these steps:

#. Install the :pypi:`django-celery-results` library:

.. code-block:: console

$ pip install django-celery-results

#. Add ``django_celery_results`` to ``INSTALLED_APPS`` in your
Django project's :file:`settings.py`::

INSTALLED_APPS = (
...,
'django_celery_results',
)

Note that there is no dash in the module name, only underscores.

#. Create the Celery database tables by performing a database migrations:

.. code-block:: console

$ python manage.py migrate django_celery_results

#. Configure Celery to use the :pypi:`django-celery-results` backend.

Assuming you are using Django's :file:`settings.py` to also configure
Celery, add the following settings:

.. code-block:: python

CELERY_RESULT_BACKEND = 'django-db'

For the cache backend you can use:

.. code-block:: python

CELERY_CACHE_BACKEND = 'django-cache'

We can also use the cache defined in the CACHES setting in django.

.. code-block:: python

# celery setting.
CELERY_CACHE_BACKEND = 'default'

# django setting.
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'my_cache_table',
}
}

If you want to include extended information about your tasks remember to enable the `result_extended` setting.
More information here: https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended

.. code-block:: python

CELERY_RESULT_EXTENDED = True

3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Contents

.. toctree::
:maxdepth: 1


getting_started
copyright

.. toctree::
Expand Down