Turn caching off in debug mode in Django

django

Solution

You can set up caches conditionally in your `settings.py`, like this:

if not DEBUG:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
        }
    }
else:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        }
    }

Problem

I am using memcached view caching for my production servers on some very computationally & DB intense views, like so: ``` urlpatterns = ('', (r'^foo/(\d{1,2})/$', cache_page(60 * 15)(my_view)), ) ``` Is there a way to turn caching off when DEBUG==True in Settings.py so that I don't have to worry about obselete view outputs being cached and can use my IDE's debugger?

Original source