mirror of
https://github.com/django/django.git
synced 2025-10-30 00:56:09 +00:00
[1.6.x] Fixed #21581 -- Fixed a number of issues with collectstatic.
When STATIC_ROOT wasn't set, collectstatic --clear would delete
every files within the current directory and its descendants.
This patch makes the following changes:
Prevent collectstatic from running if STATIC_ROOT isn't set.
Fixed an issue that prevented collectstatic from displaying the
destination directory.
Changed the warning header to notify when the command is run
in dry-run mode.
Backport of 4befb3015c from master
This commit is contained in:
@@ -223,6 +223,17 @@ class TestFindStatic(CollectionTestCase, TestDefaults):
|
||||
self.assertIn('apps', force_text(lines[1]))
|
||||
|
||||
|
||||
class TestConfiguration(StaticFilesTestCase):
|
||||
def test_location_empty(self):
|
||||
err = six.StringIO()
|
||||
for root in ['', None]:
|
||||
with override_settings(STATIC_ROOT=root):
|
||||
with six.assertRaisesRegex(
|
||||
self, ImproperlyConfigured,
|
||||
'without having set the STATIC_ROOT setting to a filesystem path'):
|
||||
call_command('collectstatic', interactive=False, verbosity=0, stderr=err)
|
||||
|
||||
|
||||
class TestCollection(CollectionTestCase, TestDefaults):
|
||||
"""
|
||||
Test ``collectstatic`` management command.
|
||||
|
||||
Reference in New Issue
Block a user