From dc83f99df0b8162f84b362a68e5f0f0fa6bdd5dd Mon Sep 17 00:00:00 2001 From: MansurAliKoroglu <43291306+MansurAliKoroglu@users.noreply.github.com> Date: Wed, 15 Dec 2021 19:18:06 +0300 Subject: [PATCH] Add documentation for constance_dbs config (#462) Co-authored-by: Mansur Ali Koroglu --- docs/backends.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/backends.rst b/docs/backends.rst index 4e330d0..2bacb0a 100644 --- a/docs/backends.rst +++ b/docs/backends.rst @@ -110,6 +110,11 @@ Please make sure to apply the database migrations:: python manage.py migrate database --fake +.. note:: If you have multiple databases you can set what databases + will be used with ``CONSTANCE_DBS`` + + CONSTANCE_DBS = "default" + Just like the Redis backend you can set an optional prefix that is used during database interactions (it defaults to an empty string, ``''``). To use something else do this:: @@ -137,17 +142,17 @@ configured cache backend to enable this feature, e.g. "default":: incompatible with cross-process caching like the local memory cache backend included in Django because correct cache invalidation can't be guaranteed. - + If you try this, Constance will throw an error and refuse to let your application start. You can work around this by subclassing ``constance.backends.database.DatabaseBackend`` and and overriding `__init__` to remove the check. You'll want to consult the source code for that function to see - exactly how. - - We're deliberately being vague about this, because it's + exactly how. + + We're deliberately being vague about this, because it's dangerous; the behavior is undefined, and could even cause - your app to crash. Nevertheless, there are some limited + your app to crash. Nevertheless, there are some limited circumstances in which this could be useful, but please think carefully before going down this path.