-1

When I shut down my PC and reopen my project every time I have to change the CSS file name to see the changes on the web. I have tried many ways to fix these issues.

I have researched online but I did not find any answer on this.


I have tried these ways to fix this error:

  • I have tried settings up STATIC_ROOT=''.
  • I have tried setting up STATICFILES_DIRS=[].

Please guide me to solve this error.

2
  • I don't think this is a Django specific problem. It's more of a browser cache problem. try using firefox browser and force reload (ctrl+f5 or ctrl+R in chrome) Commented Jun 25, 2022 at 6:02
  • checkout this question Commented Jun 25, 2022 at 6:05

1 Answer 1

1

Maybe your pc is using the file stored in the cache.

You could do something like this to force update the file:

<link href="{% static 'custom/custom.css'%}?{% now 'U' %}" rel="stylesheet">

Here you generate a unique timestamp every time when you update the page. This triggers a update of the file..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.