'Changes made to (static) CSS file not reflecting in Django development server
I am making a Web app using Django and was having some trouble getting the changes made in the CSS file (which is stored in the static directory of my app) to reflect onto the development server.
To be clear the server is able to access static files, however, it is currently stuck on an old iteration of my CSS file. A similar problem had occurred a few weeks ago, when any change I made to the CSS file wasn't showing up. That problem fixed itself after a few days.
However, not getting immediate visual feedback is extremely frustrating. I have tried all of the following to rectify the problem:
- My DEBUG is set to 'True'
- I have provided a STATIC_URL
- I tried 'collecting' the static files. The command worked but the dev server is still not reflecting changes made to the CSS file
- I provided a STATIC_ROOT, STATICFILES_DIR and STATICFILES_FINDER. Currently these are commented out as I realized some of these are for production only or are unnecessary for development.
My static resources are kept in the 'static' directory of one of my apps -- 'post_it_gen' which is part of the project. According to the documentation this should be automatically searched by Django.
Any new suggestions would be greatly appreciated.
Solution 1:[1]
In my case, my browser was caching the Js and CSS files and thus I was unable to see the changes.
You can try hard refreshing the page
For chrome/chromium browsers:
Ctrl + F5 or Ctrl + Shift + R
both works for me.
Solution 2:[2]
Do a Hard Refresh in Browser
Firefox:
Window, Linux: 1.] ctrl + F5 2.] Ctrl + Shift + R
Mac 1.] Command + Shift + R
Chrome:
Window, Linux: 1.] ctrl + F5 2.] Ctrl + usual refresh
Mac 1.] Command + Shift + R 2.] Ctrl + usual refresh
Safari:
Mac 1.] Shift + Command + R
Solution 3:[3]
clearing cache worked for me. after deleting it 2 times, changes are displayed by just refresh button
Solution 4:[4]
just try hard refreshing the page For chrome/chromium browsers:
Ctrl + Shift + R
it's done!
Solution 5:[5]
Use incognito mode to test the changes, as the normal window will keep saving your changes in cache which is not the case with incognito window.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | theshubhagrwl |
| Solution 2 | Vishal Singh |
| Solution 3 | Sonalika Singhal |
| Solution 4 | Moslem Salehi Ziri |
| Solution 5 | Yudhishthir Singh |
