Search code examples
javascriptpythoncssdjangostatic-files

How to fix not updating problem with static files in Django port 8000


So when you make changes to your CSS or JS static file and run the server, sometimes what happens is that the browser skips the static file you updated and loads the page using its cache memory, how to avoid this problem?


Solution

  • Well there are multiple ways to avoid this problem

    1. the simplest way is by:

      • if you are using Mac: Command+Option+R
      • if you are using Windows: Ctrl+F5

    What it does is that it re-downloads the cache files enabling the update of the static files in the browser.

    1. Another way is by:

      • making a new static file and pasting the existing code of the previously used static file and then running the server

    What happens, in this case, is that the browser doesn't use the cache memory for rendering the page as it assumes it is a different file.