summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJames Bligh <blighj@users.noreply.github.com>2025-07-26 13:50:34 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-08-05 16:37:43 +0200
commit6142e3f347c6f9415165d385d3eba4211a052d96 (patch)
treecabe81a42409fed427f3776b447de41728f58d51 /django
parent65377325855ab6faa7ac487e336e9902c6268c96 (diff)
Fixed #26583 -- Silenced individual clashing name warnings in collectstatic's default verbosity.
Made collectstatic report individual destination conflicts only at verbosity 2+. Made verbosity level 1 report a summary count of skipped files.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/staticfiles/management/commands/collectstatic.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
index d5cd3f56ca..7f1d612bf0 100644
--- a/django/contrib/staticfiles/management/commands/collectstatic.py
+++ b/django/contrib/staticfiles/management/commands/collectstatic.py
@@ -25,6 +25,7 @@ class Command(BaseCommand):
self.symlinked_files = []
self.unmodified_files = []
self.post_processed_files = []
+ self.skipped_files = []
self.storage = staticfiles_storage
self.style = no_style()
@@ -134,12 +135,13 @@ class Command(BaseCommand):
found_files[prefixed_path] = (storage, path)
handler(path, prefixed_path, storage)
else:
+ self.skipped_files.append(prefixed_path)
self.log(
"Found another file with the destination path '%s'. It "
"will be ignored since only the first encountered file "
"is collected. If this is not what you want, make sure "
"every static file has a unique path." % prefixed_path,
- level=1,
+ level=2,
)
# Storage backends may define a post_process() method.
@@ -165,6 +167,7 @@ class Command(BaseCommand):
"modified": self.copied_files + self.symlinked_files,
"unmodified": self.unmodified_files,
"post_processed": self.post_processed_files,
+ "skipped": self.skipped_files,
}
def handle(self, **options):
@@ -212,9 +215,10 @@ class Command(BaseCommand):
modified_count = len(collected["modified"])
unmodified_count = len(collected["unmodified"])
post_processed_count = len(collected["post_processed"])
+ skipped_count = len(collected["skipped"])
return (
"\n%(modified_count)s %(identifier)s %(action)s"
- "%(destination)s%(unmodified)s%(post_processed)s."
+ "%(destination)s%(unmodified)s%(post_processed)s%(skipped)s."
) % {
"modified_count": modified_count,
"identifier": "static file" + ("" if modified_count == 1 else "s"),
@@ -232,6 +236,11 @@ class Command(BaseCommand):
and ", %s post-processed" % post_processed_count
or ""
),
+ "skipped": (
+ ", %s skipped due to conflict" % skipped_count
+ if collected["skipped"]
+ else ""
+ ),
}
def log(self, msg, level=2):