summaryrefslogtreecommitdiff
path: root/django/contrib/staticfiles/management/commands/collectstatic.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/staticfiles/management/commands/collectstatic.py')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index e5ae48f9fe..7e81ef19ee 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -1,5 +1,6 @@
import os
from collections import OrderedDict
+from contextlib import suppress
from django.apps import apps
from django.contrib.staticfiles.finders import get_finders
@@ -312,10 +313,8 @@ class Command(BaseCommand):
else:
self.log("Linking '%s'" % source_path, level=1)
full_path = self.storage.path(prefixed_path)
- try:
+ with suppress(OSError):
os.makedirs(os.path.dirname(full_path))
- except OSError:
- pass
try:
if os.path.lexists(full_path):
os.unlink(full_path)