Import from django.core.cache import cache
Error:
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Solution:
from django.conf import settings
settings.configure(DEBUG=True)
Done!