I have python-django site which contains css and js files. For every time of updating/adding css or js have to clear the cache of the browser then only its reflect in browser.
Is the any specific way to do avoid every time cache clear and check?
Is there any specific settings available in django to avoid storing browser cache?
Here's how... When you're in Google Chrome, click on View, then select Developer, then Developer Tools. Alternatively, you can right click on a page in Chrome, then click Inspect. Click on the Network tab, then check the box to Disable cache.
It is a good idea to clear your browser cache because it: prevents you from using old forms. protects your personal information. helps our applications run better on your computer.
The user either has to clear the browser cookie & reload the page or else he or she has to do a hard refresh of the page by pressing Ctrl+F5.
When a browser caches a CSS stylesheet, what it's doing is getting that stylesheet from the server once, saving it, and then serving its own saved version of that stylesheet to the user anytime the page being loaded requests it.
You could just append something to the updated js/css file, like this. For example versioning "?v=1.0".
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}_css/style.css?v=1.6">
So this way, every time the browser detects a change, it will automatically fetch the new file. Simple and clean.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With