summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index 523f313c13..e6b6198952 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -218,7 +218,12 @@ class Command(BaseCommand):
smart_text(fpath), level=1)
else:
self.log("Deleting '%s'" % smart_text(fpath), level=1)
- self.storage.delete(fpath)
+ full_path = self.storage.path(fpath)
+ if not os.path.exists(full_path) and os.path.lexists(full_path):
+ # Delete broken symlinks
+ os.unlink(full_path)
+ else:
+ self.storage.delete(fpath)
for d in dirs:
self.clear_dir(os.path.join(path, d))