Reputation: 595
I have a static css file called blog.css
, and I load it in my base.html template like this:
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'css/blog.css' %}">
But when I wanted to change something in that css, the changes doesn't appear. Due to my confusion, I tried to test some things.
blog.css
to blog2.css
The weird part is, when I make changes to blog2.css, and called it in the base.html, my changes work, such as changing the background color, and etc.
but when I make changes to blog.css
, nothing happens.
So, I tried to DELETE blog.css
, but still called it in the base.html.
everything still works when I first made that file. I'm supposed to be expecting a broken designed HTML page and a 404 in the console because the blog.css in the static folder cannot be found.
It's like the blog.css is a ghost or something that is still here in my folder somewhere.. or am I missing something?
I also tried restarting the runserver command, refreshing the page countless times, and even restarting my computer.
I'm quite new to Django and I'm trying my best to understand it, and any help given is appreciated. Thank you very much!
Upvotes: 3
Views: 6782
Reputation: 1086
As mentioned in other answers, the "cache files" seem to be the problem. Try removing the cache (I haven't tried this).
You could also change the name of the CSS file to something other than the old name. This worked for me.
Upvotes: 0
Reputation: 133
That happened to me before, it just took time and reloading the server for the changes to occur, try changing your browser to see if the CSS
is gone by now. Django uses caching in browsers to load faster. To resolve the problem you must clear the cache.
Upvotes: 4
Reputation: 595
I fixed it by clearing the cache in my browser. The blog.css from the cache is not found anymore.
Upvotes: 2
Reputation: 4213
to test the changes of css or js or any such static files follow any preferred approach listed below
Upvotes: 9