Black Lives Matter. Please consider donating to Black Girls Code today.

How to easily clear cache?

Hi,

Sometimes when I update my python code to generate new graphs. The old graphs are still being run. Is this because it is cached in my browser? Is there an easy way to get rid of it?

The browser cache will not save these. I’m not sure why this is happening for you, but for some reason the old app code is still serving the requests. You may have to stop the python process and restart it instead of relying on the automatic debugger.

I’m using this to clear the browser…

cache = Cache(app.server, config={
‘CACHE_TYPE’: ‘simple’
})

cache.clear()

as suggested by this article. Be careful though as I think this could delete your whole database if using Redis.

I use a symbolic link to my database models.py file because it’s used in multiple projects, and the automatic debugger doesn’t recognize when I change it. So when updating models.py I have to restart the python process.