Vojta Ma
Vojta Ma

Reputation: 21

Problem with updating the css file used in my Django project

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?

Upvotes: 0

Views: 124

Answers (1)

denniz crypto
denniz crypto

Reputation: 471

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

Upvotes: 1

Related Questions