Changes in CSS (Style sheet) not reflecting in the Page

Hey team,

This is the first time I am creating a post on this channel, so please assist me with the problem. I am still at a beginner level and learning how to code in Django framework. I am okay with all the basic details, however, it is the CSS integration that is creating an issue for me. Initially, when I create a project, update static files settings (as mentioned in the DOC), the projects/integration works well but later on when I login back again to complete the project, everything works but the CSS. The changes I make in CSS doesn’t get reflected the second time unlike the first time when I was able to designed the page successfully. I’ll be very thankful If I can have way-out for this issue. Thank you in advance and sorry for any inconvenience

Your browser may be caching the css files within the browser, preventing the changes from being loaded. Try doing a “full” page refresh.
On Windows in either Chrome or Firefox, hold down either the shift or ctrl key and click on the reload icon (the “circle arrow”), or do a ctrl-F5 (reload key).

You can tell whether or not this is happening by watching the console where you’re running runserver. If you don’t see requests for the css file, then the browser is using it’s cached copy. (If you are seeing requests for the css file, then there’s a different issue.)

Ken

5 Likes

To add to what @KenWhitesell said, you can also disable caching by setting an option in the Developer Tools for your browser. This is a nice alternative so you can avoid having to remember to clear your cache with a keyboard shortcut.


Usually, on the Network tab, you can find something that will disable caching. In the screenshot I posted, I’m showing the Firefox developer tools Network tab. You can see a “Disable Cache” checkbox on the right side. Chrome developer tools have a very similar option.

1 Like

Hello there, I run into a similar issue, but even after disabling caching, there is no changes reflected on my HTML. What else can I try?

If you want to work through this in detail, please open up a new topic for it.

Please include how you’re running your server, the name of one of the css files that are not showing updates, and the template being used that is supposed to load that template.
(We are likely to have more questions once we have this information.)