Django staticfiles not being updated in browser

2.7k views Asked by At

this is a weird error. I'm working on a Django project in local.

when I make changes to staticfiles (.css and.js), they don't appear in the updated version in browsers.

So if I add new styles in a .css file, changes appear in Chrome but not in Firefox.

Similarly .js files changes appear in firefox but not in chrome.

First, I thought this a git branch issue, removed git, didn't work.

I also tried cleaning browser cache and force refresh the website.

What's wrong?

2

There are 2 answers

2
Bogdan On BEST ANSWER

I get the same error sometimes when developing on local. The best solution I came up is restarting the browser. I still don`t know if is a Chrome related issue as it happens also with other frameworks(on local development). Try to clear your browser cache.

1
Udi On

Assuming "local mode" means you are running a regular runserver, check out if you are not running two copies of it! (In windows, open your task manager and check for more, unwanted instances of python.exe and kill them).

If you are not using runserver, but a production server, consider using a cache busting technique.