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

johnny-cache doesn't update cache after update data from manage.py command. #17

Closed
inlanger opened this issue Mar 5, 2013 · 3 comments

Comments

@inlanger
Copy link

inlanger commented Mar 5, 2013

I use some manage.py command to parse and upload some data to my database. johnny-cache cached my data once and after updates my data cache doesn't update. In database I have actual data, but my site show old data from cache.

I have to restart my memcached server to solve that problem after each data update. Anyone has similar problem?

@whatisjasongoldstein
Copy link

Your problem is that JC is activated in middleware, and management commands don't pass through middleware. This is pretty well documented and can be fixed either by activating JC in your script, or by manually clearing the models you affect.

@jself
Copy link
Collaborator

jself commented Mar 25, 2013

We've looked into solutions for this, and Django doesn't make it particularly easy due to the order of instantiation of the database/settings/etc. For now we'll leave it as activating JC in the script itself.

@jself jself closed this as completed Mar 25, 2013
@jmoiron
Copy link
Owner

jmoiron commented Apr 16, 2013

After some discussion in an email thread, I think it would work to have the __init__.py in your project directory (the place your DJANGO_SETTINGS_MODULE is) run code like this:

from johnny.cache import enable
enable()

This will make its way to the docs when 1.5 is released in the coming weeks.

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

4 participants