Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphite memcached integration does not work with django 1.5 #612

Closed
msn opened this issue Feb 3, 2014 · 12 comments
Closed

graphite memcached integration does not work with django 1.5 #612

msn opened this issue Feb 3, 2014 · 12 comments

Comments

@msn
Copy link

msn commented Feb 3, 2014

In settings.py, we have the following:

if MEMCACHE_HOSTS:
CACHE_BACKEND = 'memcached://' + ';'.join(MEMCACHE_HOSTS) + ('/?timeout=%d' % DEFAULT_CACHE_DURATION)

However, CACHE_BACKEND was deprecated in django 1.3 and dropped in django 1.5 (https://docs.djangoproject.com/en/1.5/internals/deprecation/).

My fix was to roll back django to version 1.4 in my graphite python virtualenv.

I'd suggest the release notes recommend a version of django >=1.3 (since check-dependencies.py now requires this) and <=1.4 until support for memcache against django 1.5 is added?

Thanks!

@pcn
Copy link

pcn commented Feb 3, 2014

OK, so we need to look into https://docs.djangoproject.com/en/1.5/topics/cache/ (for instance - it looks like 1.4, 1.5, and development 1.6 haven't introduced changes in the docs that stand out from a brief glimpse).

@pcn
Copy link

pcn commented Feb 3, 2014

If I'm reading the configuration correctly, using django >= 1.5, this configuration should work:

CACHE_MIDDLEWARE_SECONDS = 60
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': [
            '127.0.0.1:11211'
        ]
    }
}

My vagrant dev environment is not in any shape to test this. @msn if you have a chance to try this that'd be helpful.

@brutasse
Copy link
Member

brutasse commented Feb 4, 2014

I can't find it right now but I have opened a pull request for this.

On Tuesday, 4 February 2014 at 01:44, Peter N wrote:

If I'm reading the configuration correctly, using django >= 1.5, this configuration should work:
CACHE_MIDDLEWARE_SECONDS = 60 CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': [ '127.0.0.1:11211' ] } }

My vagrant dev environment is not in any shape to test this. @msn (https://github.com/msn) if you have a chance to try this that'd be helpful.


Reply to this email directly or view it on GitHub (#612 (comment)).

@brutasse
Copy link
Member

Fixed in #589. Could somebody close the issue?

@stevebanik
Copy link

@pcn Your suggestion worked for me. We have Django==1.5.4 and my settings.py reads:

if MEMCACHE_HOSTS:

    CACHE_MIDDLEWARE_SECONDS = 60
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': [
                '127.0.0.1:11211'
            ]
        }

}

Make sure the indentation is correct so that Python doesn't complain.

@brutasse
Copy link
Member

Closing as it's been fixed in master.

@esc
Copy link
Contributor

esc commented Jul 29, 2014

can you like the commit, just for the record.

@brutasse
Copy link
Member

@esc I did 2 comments above -- #612 (comment)

@esc
Copy link
Contributor

esc commented Jul 29, 2014

@brutasse thank you, my bad.

@wingZero21
Copy link

@pcn + @stevebanik thanks for that!!

@gsaray101
Copy link

in order for this to work, python client memecahced needs to be installed, right?

@gsaray101
Copy link

hi,

I installed memcached and python-memchace module. Inserted these lines to my local_settings.py file:

CACHE_MIDDLEWARE_SECONDS = 60
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': [
'127.0.0.1:11211'
]
}
}

When I click on a big node on graphite, it is timing out, not able to exapand the node. Any idease what might cause that, how could I increase the timeout value? I get this error from the apache log:

RuntimeError: Unable to save data of type <type 'dict'> to cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants