Everyone_Else
Everyone_Else

Reputation: 3264

CSS does not update with Django

When I modify the CSS file and then run python manage.py collectstatic, (typing in yes if prompted) and then reload the website on the localhost, I expect the CSS to be changed. Instead, it is not. What are some possible causes and solutions?

Edit: I have been calling this with collectstatic as intended, as opposed to the typo that was previously in the question. Sorry for the confusion.

Upvotes: 1

Views: 4653

Answers (4)

Getafix
Getafix

Reputation: 141

Beware of editing the wrong css file. I made the mistake of editing the one located in the "static_cdn" directory rather than the one in "static". After running collectstatic, do clear the browser cache as a few have suggested above.

Upvotes: 0

Thinh Phan
Thinh Phan

Reputation: 655

I think your command is wrong. Please try this

python manage.py collectstatic

You can refer here: https://docs.djangoproject.com/en/1.9/howto/static-files/

Upvotes: 0

aydow
aydow

Reputation: 3801

i had to clear cache to get it to update if i haven't changed it for a while. after an initial purge, it usually updates on a change.

also, as i'm using chrome, i just remove it for the last hour so it doesn't affect too many things.

Upvotes: 5

Yaztown
Yaztown

Reputation: 370

There is a typo in you command; collectstatic is one word.

The command should be:

python3 manage.py collectstatic

Also, you should setup the STATIC_URL, STATIC_ROOT and STATICFILES_DIRS in your settings.py file with the proper values.

I hope that helps.

Upvotes: 1

Related Questions