I have a website in a prod phase and need to update the css (sass). Just want to be sure that collectstatic will look only at the modified files with their timestamp, and not the whole thing (css, img, media) as it did once when I probably forgot to activate the virtual env
However, keep in mind that depending upon your deployment process, the dates for all files might be changed to the date of the deployment, leading to all files being collected.
It didn’t work the way I thought. After running a collectstatic, I ended up with a recursive additional staticfiles folder, inside the previous one, with the same files in it than in its parent folder.
It’s basically configured the same way in my settings.py although I defined STATICFILES_DIRS the old way: STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static/'),)
It probably shouldn’t make any difference though.
You could probably try removing (or commenting out) this STATICFILES_DIRS option entirely, and see if it makes a difference.
I forgot one detail, don’t know if it’s relevant or not, my static files, and the templates for that matter, are not located in the apps, but directly in the project/root folder. I don’t think it can have an influence on the collecstatic command though.
My staticfiles folder is at the root of the project too. You could probably delete the staticfiles folder and anything inside it. It doesn’t seem like normal behaviour when running that command.
Actually, this does appear to be a configuration issue.
You have:
The collectstatic is going to search each of those directories, in turn, and find the static files to copy. So what’s happening is that it’s finding the static directory inside BASE_DIR and the files in static directly causing two copies to be made.
Holy, didn’t know this could be of importance except in the case you want escape some characters. I tend to use single or double quotes a little randomly I must say.