Opened 9 years ago
Last modified 9 years ago
#25346 closed Cleanup/optimization
collectstatic --clear doesn't delete broken symlinks from the STATIC_ROOT — at Version 1
Reported by: | Evan Heidtmann | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
In my STATIC_ROOT, I have a directory containing some broken symlinks.
I run ./manage.py collectstatic -l -c
I see "Deleting '...'" for each of the broken symlinks, and no corresponding "Linking '...'" lines. I would expect the broken symlinks to be gone. But they still exist.
Steps to reproduce:
ln -s asdfasd_something_that_doesnt_exist_fasdfasdf $STATIC_ROOT/broken_symlink ls -l $STATIC_ROOT/broken_symlink ./manage.py collectstatic -l -c --noinput | grep broken_symlink ls -l $STATIC_ROOT/broken_symlink
How could the broken symlinks get there in the first place? Answer: I'm using collectstatic -l and I deleted the original static files from my app, so the symlinks made last time still exist.
(Why do I care? Answer: this causes real trouble when used with WhiteNoise, because it can't find the original file and fails to start)