Skip to content

Commit

Permalink
document requirement for shared cache (see #141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed May 14, 2024
1 parent 1fe9728 commit 63e6647
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/source/include/quickstart_as_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@
},
}

# If you use ACMEv2 or Celery, you must configure a cache which shares data
# between different processes (e.g. between different uWSGI worker processes).
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": "redis://127.0.0.1:6379",
"OPTIONS": {"db": 1},
}
}

# The hostname used by default for URLs in certificates. Your Django project
# should be available under this URL using HTTP (see below). If you use
# ACMEv2, you will also need HTTPS.
CA_DEFAULT_HOSTNAME = "ca.example.com"

# RECOMMENDED: Use Celery as an asynchronous task worker if configured
# RECOMMENDED: Use Celery as an asynchronous task worker
CELERY_BROKER_URL = "redis://127.0.0.1:6379/0"
9 changes: 9 additions & 0 deletions docs/source/quickstart/as_app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Required software

You do not need any special software besides Python |minimum-python| or later and a recent version of pip.

If you want to use ACMEv2 or Celery, you need a cache that shares data between individual processes. From the
backends included in Django, Memcached and Redis do this. This document configures Redis as a cache.

It is strongly recommended that you run a `Celery task queue <https://docs.celeryproject.org/>`_. If you do,
you need a message transport like RabbitMQ or Redis. Redis is used in the examples below, because it is
easiest to set up and doubles as a cache.
Expand Down Expand Up @@ -84,6 +87,12 @@ You also need to include the URLs in your main :file:`urls.py`:
.. literalinclude:: /include/quickstart_as_app/urls.py
:language: python

You can verify (some) aspects of the setup using Django system checks:

.. code-block:: console
user@host:~$ python manage.py check --deploy
Finally, invoke the regular :command:`manage.py` commands when you add new apps:

.. code-block:: console
Expand Down

0 comments on commit 63e6647

Please sign in to comment.