[Django]-Django server not making changes to CSS

4👍

I oftenly have the same issue, you should delete the staticfiles directory.
Additionally, you should add “no cache” header to your HTML headers in your templates, at least for development.

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

In case of trouble, you can also force your browser to clear its cache.

In case you want to reconstruct the ‘staticfiles’ directory, you can run the command:

python manage.py collectstatic

You do not need to stop/relaunch the django server, it has no effect on the web files (HTML/JS/CSS).

0👍

I think that you have to collect the static files with this command, from the server instance :

./manage.py collectstatic

Then the updates in static files will be considered.

0👍

It is browser cache problem. You can solve it in many ways but what I found as the simplest way is to try out Incognito or Private mode of your browser. You will see every single change of css file instantly.

👤yuv

Leave a comment