Skip to content

Commit

Permalink
[3.0.x] Fixed #30802 -- Prevented manifest creation when running coll…
Browse files Browse the repository at this point in the history
…ectstatic in dry run mode.

Backport of fa8fe09 from master
  • Loading branch information
paul-eclipse authored and felixxm committed Sep 27, 2019
1 parent 0c655f1 commit 5d63bf0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django/contrib/staticfiles/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ def load_manifest(self):
def post_process(self, *args, **kwargs):
self.hashed_files = {}
yield from super().post_process(*args, **kwargs)
self.save_manifest()
if not kwargs.get('dry_run'):
self.save_manifest()

def save_manifest(self):
payload = {'paths': self.hashed_files, 'version': self.manifest_version}
Expand Down
5 changes: 5 additions & 0 deletions tests/staticfiles_tests/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ def run_collectstatic(self):
super().run_collectstatic(dry_run=True)


@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.ManifestStaticFilesStorage')
class TestCollectionDryRunManifestStaticFilesStorage(TestCollectionDryRun):
pass


class TestCollectionFilesOverride(CollectionTestCase):
"""
Test overriding duplicated files by ``collectstatic`` management command.
Expand Down

0 comments on commit 5d63bf0

Please sign in to comment.