diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 0017f46708..dad5097620 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -436,7 +436,6 @@ CACHES = { } # The cache backend to use. See the docstring in django.core.cache for the # possible values. -CACHE_BACKEND = 'locmem://' CACHE_MIDDLEWARE_KEY_PREFIX = '' CACHE_MIDDLEWARE_SECONDS = 600 CACHE_MIDDLEWARE_ALIAS = 'default' diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index ced9875b07..2c75f6c671 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -75,11 +75,21 @@ def parse_backend_uri(backend_uri): return scheme, host, params if not settings.CACHES: - import warnings - warnings.warn( - "settings.CACHE_* is deprecated; use settings.CACHES instead.", - PendingDeprecationWarning - ) + legacy_backend = getattr(settings, 'CACHE_BACKEND', None) + if legacy_backend: + import warnings + warnings.warn( + "settings.CACHE_* is deprecated; use settings.CACHES instead.", + PendingDeprecationWarning + ) + else: + # The default cache setting is put here so that we + # can differentiate between a user who has provided + # an explicit CACHE_BACKEND of locmem://, and the + # default value. When the deprecation cycle has completed, + # the default can be restored to global_settings.py + settings.CACHE_BACKEND = 'locmem://' + # Mapping for new-style cache backend api backend_classes = { 'memcached': 'memcached.CacheClass',