Loading django/core/cache/__init__.py +0 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ from django.core import signals from django.core.cache.backends.base import ( BaseCache, CacheKeyWarning, InvalidCacheBackendError, ) from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string __all__ = [ Loading @@ -29,9 +28,6 @@ __all__ = [ DEFAULT_CACHE_ALIAS = 'default' if DEFAULT_CACHE_ALIAS not in settings.CACHES: raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS) def _create_cache(backend, **kwargs): try: Loading django/core/checks/__init__.py +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ from .messages import ( from .registry import Tags, register, run_checks, tag_exists # Import these to force registration of checks import django.core.checks.caches # NOQA isort:skip import django.core.checks.compatibility.django_1_8_0 # NOQA isort:skip import django.core.checks.model_checks # NOQA isort:skip import django.core.checks.security.base # NOQA isort:skip Loading django/core/checks/caches.py 0 → 100644 +18 −0 Original line number Diff line number Diff line from __future__ import unicode_literals from django.conf import settings from django.core.cache import DEFAULT_CACHE_ALIAS from . import Error, Tags, register E001 = Error( "You must define a '%s' cache in your CACHES setting." % DEFAULT_CACHE_ALIAS, id='caches.E001', ) @register(Tags.caches) def check_default_cache_is_configured(app_configs, **kwargs): if DEFAULT_CACHE_ALIAS not in settings.CACHES: return [E001] return [] django/core/checks/registry.py +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ class Tags(object): Built-in tags for internal checks. """ admin = 'admin' caches = 'caches' compatibility = 'compatibility' models = 'models' security = 'security' Loading docs/ref/checks.txt +10 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ Django's system checks are organized using the following tags: * ``compatibility``: Flagging potential problems with version upgrades. * ``security``: Checks security related configuration. * ``templates``: Checks template related configuration. * ``caches``: Checks cache related configuration. Some checks may be registered with multiple tags. Loading Loading @@ -569,3 +570,12 @@ configured: * **templates.E001**: You have ``'APP_DIRS': True`` in your :setting:`TEMPLATES` but also specify ``'loaders'`` in ``OPTIONS``. Either remove ``APP_DIRS`` or remove the ``'loaders'`` option. Caches ------ The following checks verify that your :setting:`CACHES` setting is correctly configured: * **caches.E001**: You must define a ``'default'`` cache in your :setting:`CACHES` setting. Loading
django/core/cache/__init__.py +0 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ from django.core import signals from django.core.cache.backends.base import ( BaseCache, CacheKeyWarning, InvalidCacheBackendError, ) from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string __all__ = [ Loading @@ -29,9 +28,6 @@ __all__ = [ DEFAULT_CACHE_ALIAS = 'default' if DEFAULT_CACHE_ALIAS not in settings.CACHES: raise ImproperlyConfigured("You must define a '%s' cache" % DEFAULT_CACHE_ALIAS) def _create_cache(backend, **kwargs): try: Loading
django/core/checks/__init__.py +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ from .messages import ( from .registry import Tags, register, run_checks, tag_exists # Import these to force registration of checks import django.core.checks.caches # NOQA isort:skip import django.core.checks.compatibility.django_1_8_0 # NOQA isort:skip import django.core.checks.model_checks # NOQA isort:skip import django.core.checks.security.base # NOQA isort:skip Loading
django/core/checks/caches.py 0 → 100644 +18 −0 Original line number Diff line number Diff line from __future__ import unicode_literals from django.conf import settings from django.core.cache import DEFAULT_CACHE_ALIAS from . import Error, Tags, register E001 = Error( "You must define a '%s' cache in your CACHES setting." % DEFAULT_CACHE_ALIAS, id='caches.E001', ) @register(Tags.caches) def check_default_cache_is_configured(app_configs, **kwargs): if DEFAULT_CACHE_ALIAS not in settings.CACHES: return [E001] return []
django/core/checks/registry.py +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ class Tags(object): Built-in tags for internal checks. """ admin = 'admin' caches = 'caches' compatibility = 'compatibility' models = 'models' security = 'security' Loading
docs/ref/checks.txt +10 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ Django's system checks are organized using the following tags: * ``compatibility``: Flagging potential problems with version upgrades. * ``security``: Checks security related configuration. * ``templates``: Checks template related configuration. * ``caches``: Checks cache related configuration. Some checks may be registered with multiple tags. Loading Loading @@ -569,3 +570,12 @@ configured: * **templates.E001**: You have ``'APP_DIRS': True`` in your :setting:`TEMPLATES` but also specify ``'loaders'`` in ``OPTIONS``. Either remove ``APP_DIRS`` or remove the ``'loaders'`` option. Caches ------ The following checks verify that your :setting:`CACHES` setting is correctly configured: * **caches.E001**: You must define a ``'default'`` cache in your :setting:`CACHES` setting.