Reputation: 808
I have 2 instances of django application. One is frontend - a normal wsgi app. Another is backend - a twisted daemon running with ./manage.py rundaemon. They share django settigns and models.
Now, when one of them has a query, it got cached. And when another updates database - the cache will not be flushed. That's obviously because they have no clue about another instance accessing the same database.
Is there a way to disable caching, or flush it manually and force query to be reexecuted?
(I guess the admin app does flush query caches somehow)
Upvotes: 4
Views: 2688
Reputation: 64368
I'm not sure if this is the best solution, but it worked for me when I faced the same problem.
import django
django.db.connection.close()
The connection will automatically get reopened the next time it is needed.
Upvotes: 1