Fixed #21581 -- Fixed a number of issues with collectstatic. #2057

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@loic
Member

loic commented Dec 9, 2013

No description provided.

@@ -290,7 +290,7 @@
# Absolute path to the directory static files should be collected to.
# Example: "/var/www/example.com/static/"
-STATIC_ROOT = ''
+STATIC_ROOT = None

This comment has been minimized.

@timgraham

timgraham Dec 28, 2013

Member

setting documentation should be updated for the new default value

@timgraham

timgraham Dec 28, 2013

Member

setting documentation should be updated for the new default value

This comment has been minimized.

@loic

loic Dec 29, 2013

Member

Done.

@loic

loic Dec 29, 2013

Member

Done.

@timgraham

View changes

tests/staticfiles_tests/tests.py
+ err = six.StringIO()
+ for root in ['', None]:
+ with override_settings(STATIC_ROOT=root):
+ with self.assertRaises(ImproperlyConfigured):

This comment has been minimized.

@timgraham

timgraham Dec 28, 2013

Member

should we verify exception message as well?

@timgraham

timgraham Dec 28, 2013

Member

should we verify exception message as well?

+ 'location as specified in your settings'
+ )
+
+ if (isinstance(self.storage._wrapped, FileSystemStorage) and

This comment has been minimized.

@timgraham

timgraham Dec 28, 2013

Member

could we add a test for this bug by verifying the output?

@timgraham

timgraham Dec 28, 2013

Member

could we add a test for this bug by verifying the output?

This comment has been minimized.

@loic

loic Dec 29, 2013

Member

I don't know how to test this since it's displayed when run in interactive mode. Any idea?

@loic

loic Dec 29, 2013

Member

I don't know how to test this since it's displayed when run in interactive mode. Any idea?

@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Dec 28, 2013

Member

How can I reproduce the data loss issue? With a default project setup and running collectstatic I just seem to get an "admin" directory in directory that contains manage.py. I guess if I already had an admin directory with other stuff it would get nuked?

If we're going to backport this could you add it to the 1.6.2 release notes as well?

Member

timgraham commented Dec 28, 2013

How can I reproduce the data loss issue? With a default project setup and running collectstatic I just seem to get an "admin" directory in directory that contains manage.py. I guess if I already had an admin directory with other stuff it would get nuked?

If we're going to backport this could you add it to the 1.6.2 release notes as well?

@loic

This comment has been minimized.

Show comment
Hide comment
@loic

loic Dec 29, 2013

Member

@timgraham did you use the --clear option? i.e. ./manage.py collectstatic --clear.

Member

loic commented Dec 29, 2013

@timgraham did you use the --clear option? i.e. ./manage.py collectstatic --clear.

@loic

This comment has been minimized.

Show comment
Hide comment
@loic

loic Dec 29, 2013

Member

@timgraham, reading your comment again, I probably should specify that this wouldn't just nuke from the project root and below, but rather from the current cwd and below. So if you were to run /absolute/path/to/manage.py collectstatic --clear --noinput from your home directory, you would nuke your whole home directory.

Member

loic commented Dec 29, 2013

@timgraham, reading your comment again, I probably should specify that this wouldn't just nuke from the project root and below, but rather from the current cwd and below. So if you were to run /absolute/path/to/manage.py collectstatic --clear --noinput from your home directory, you would nuke your whole home directory.

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.
@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Dec 31, 2013

Member

merged in 4befb30.

Member

timgraham commented Dec 31, 2013

merged in 4befb30.

@timgraham timgraham closed this Dec 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment