0

I currently have my seetings file configures to use the memcache cache.

'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache'

Whilst the site runs flawlessly, I see debug lines such as:

[05/Dec/2014 15:28:53] code 400, message Bad HTTP/0.9 request type ('get')
[05/Dec/2014 15:28:53] "get :1:views.decorators.cache.cache_header..439e23553bea98b3b35e7b94c1f72576.en-gb.AUS_Eastern_Standard_Time" 400 -
[05/Dec/2014 15:28:53] "GET /RSA/ HTTP/1.1" 200 968

So I'm interested in learning how to fix this, and how I can actually test whether the backend cache is being used. It is currently implemented to be used with all pages.

Red Shift
  • 1,312
  • 2
  • 17
  • 29

2 Answers2

1

Went back to the docks and started playing around with the port number for the location.

Was able to make it report a different error that referenced 63894 as being the correct port number. Interesting to note that it was not the port the actual site was running off - 88. Maybe it was something to do with the fact that it was running with the django manage.py runserver command and was only a development server etc.

Anyway this fixed the problem. Code below as a reference.

CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:63894',
        }
    }
Red Shift
  • 1,312
  • 2
  • 17
  • 29
0

Adapted from previous response

The only possible reason I see in bad request error is due to misconfiguration of hosts settings as also discussed here.

Also to check for memcached, Please check this link.

Community
  • 1
  • 1
Gautam Bhalla
  • 1,170
  • 2
  • 10
  • 16
  • So I already have ALLOWED_HOSTS set up. However, attempting to import the cache form within the shell gave: `>>> from django.core.cache import cache cache.set('key', 'value') File "", line 1 from django.core.cache import cache cache.set('key', 'value') ^ SyntaxError: invalid syntax` – Red Shift Dec 07 '14 at 23:49