0

I am creating my first Django project and I want to create a css stylesheet for my project. The css file that I want to use is /static/css/main.css. I load the static file in my base.html template using:

{% load static %}
<head>
<link rel="stylesheet" href="{% static 'css/main.css' %}">
</head>

The problem is that when I edit and save the main.css file, no change is visible on any of the webpages. When I checked the url 127.0.0.0:8000/static/css/main.css, it shows the css file, but only the old version before I edited it. I tried restarting both the development server and my virtualenv and making sure that I have saved the changes, but neither resolved the issue. When I viewed the page source code and clicked on the link to the css stylesheet, it still showed the old version on the url 127.0.0.0:8000/static/css/main.css.

When I add styling inside the <style></style> tags, it works just fine.

How do I make it so that it shows the new version of the css file?

1 Answer 1

1

your problem may be caused by the browser using a cached version of your css file. try disabling cache in firefox inspectelements > storage > cacheStorage.

if it persists try loading the page in incognito mode

1
  • if it solved you problem. please make it your recommended answer Apr 26, 2020 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.