Django cache framework with apache and mod_wsgi

27 views
Skip to first unread message

Gabriel-Cristian Muj

unread,
Nov 17, 2013, 5:47:29 PM11/17/13
to django...@googlegroups.com
Hi, 

  I am trying to use django's cache framework (using file system as backend). When running development server, everything is fine, but with apache I cannot make it work. Sometimes is working, sometimes not.

This is in my settings.py:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        'LOCATION': '/var/tmp/django_cache',
    }
}

Do I need to add some extra configuration for apache to make it work?
I use cache for upload progress based on django-progressbarupload this is part of the code where cache is used:

#set
self.cache_key = "%s_%s" % (self.request.META['REMOTE_ADDR'], self.progress_id)
cache.set(self.cache_key, {
      'length': self.content_length,
      'uploaded': 0
})

#update
data = cache.get(self.cache_key)
data['uploaded'] += self.chunk_size
cache.set(self.cache_key, data)

#get
cache_key = "%s_%s" % (request.META['REMOTE_ADDR'], progress_id)
data = cache.get(cache_key)
Reply all
Reply to author
Forward
0 new messages