title: Django.core.exceptions.ImproperlyConfigured:
body: <p>After installing redis and django on an ubuntu ec2 node, based on <a href="http://michal.karzynski.pl/blog/2013/07/14/using-redis-as-django-session-store-and-cache-backend/" rel="nofollow">http://michal.karzynski.pl/blog/2013/07/14/using-redis-as-django-session-store-and-cache-backend/</a> , I have been trying to experiment with the low level cache api (<a href="https://docs.djangoproject.com/en/1.7/topics/cache/#the-low-level-cache-api" rel="nofollow">https://docs.djangoproject.com/en/1.7/topics/cache/#the-low-level-cache-api</a>) at the command line</p>
  
  <pre><code> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
   [GCC 4.8.2] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   &gt;&gt;&gt; import django
   &gt;&gt;&gt; import redis
   &gt;&gt;&gt; from django.core.cache import cache
   Traceback (most recent call last):
     File "&lt;stdin&gt;", line 1, in &lt;module&gt;
     File "/home/ubuntu/.virtualenvs/env1/lib/python3.4/site-packages/django/core/cache/__init__.py", line 34, in &lt;module&gt;
       if DEFAULT_CACHE_ALIAS not in settings.CACHES:
     File "/home/ubuntu/.virtualenvs/env1/lib/python3.4/site-packages/django/conf/__init__.py", line 46, in __getattr__
       self._setup(name)
     File "/home/ubuntu/.virtualenvs/env1/lib/python3.4/site-packages/django/conf/__init__.py", line 40, in _setup
       % (desc, ENVIRONMENT_VARIABLE))
   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.
  </code></pre>
  
  <p>I have a django project in place, and have set up the middleware to look like:</p>
  
  <pre><code>MIDDLEWARE_CLASSES = (
      'django.middleware.cache.UpdateCacheMiddleware',    # This must be first on the list
      'django.middleware.common.CommonMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
      'django.middleware.cache.FetchFromCacheMiddleware', # This must be last
  )
  </code></pre>
  
  <p>How can I get this working?</p>