You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

caches.py 415B

12345678910111213141516
  1. from django.conf import settings
  2. from django.core.cache import DEFAULT_CACHE_ALIAS
  3. from . import Error, Tags, register
  4. E001 = Error(
  5. "You must define a '%s' cache in your CACHES setting." % DEFAULT_CACHE_ALIAS,
  6. id='caches.E001',
  7. )
  8. @register(Tags.caches)
  9. def check_default_cache_is_configured(app_configs, **kwargs):
  10. if DEFAULT_CACHE_ALIAS not in settings.CACHES:
  11. return [E001]
  12. return []