From 566348f6a13144e4a9e30f30d8715173ce200d41 Mon Sep 17 00:00:00 2001 From: "pavel.kharlamov" Date: Tue, 23 Jan 2024 15:30:26 +0300 Subject: [PATCH] Skip checks when RATELIMIT_ENABLE is set to False --- django_ratelimit/checks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django_ratelimit/checks.py b/django_ratelimit/checks.py index f6b76f4..50d2b81 100644 --- a/django_ratelimit/checks.py +++ b/django_ratelimit/checks.py @@ -22,6 +22,10 @@ @checks.register(checks.Tags.caches, 'django_ratelimit') def check_caches(app_configs, **kwargs): errors = [] + + if not getattr(settings, 'RATELIMIT_ENABLE', True): + return errors + cache_name = getattr(settings, 'RATELIMIT_USE_CACHE', 'default') caches = getattr(settings, 'CACHES', None) if caches is None: