Opened 11 years ago
Closed 10 years ago
#22704 closed New feature (wontfix)
"collectstatic" fails when there is a dangling symlink (in the source)
Reported by: | Daniel Hahler | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | dev |
Severity: | Normal | Keywords: | symlink |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If there exists a dangling symlink in one of STATICFILES_DIRS
, manage.py collectstatic
aborts as follows:
% python manage.py collectstatic --noinput Copying '/tmp/django-static.in/bar' Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "…/django-master/django/core/management/__init__.py", line 429, in execute_from_command_line utility.execute() File "…/django-master/django/core/management/__init__.py", line 421, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "…/django-master/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "…/django-master/django/core/management/base.py", line 337, in execute output = self.handle(*args, **options) File "…/django-master/django/core/management/base.py", line 532, in handle return self.handle_noargs(**options) File "…/django-master/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle_noargs collected = self.collect() File "…/django-master/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect handler(path, prefixed_path, storage) File "…/django-master/django/contrib/staticfiles/management/commands/collectstatic.py", line 314, in copy_file with source_storage.open(path) as source_file: File "…/django-master/django/core/files/storage.py", line 35, in open return self._open(name, mode) File "…/django-master/django/core/files/storage.py", line 173, in _open return File(open(self.path(name), mode)) IOError: [Errno 2] No such file or directory: u'/tmp/django-static.in/bar'
I think there should be at least an option to skip dangling symlinks, or skip them by default and log a warning message.
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Yes, I have tested it yesterday on master.
I came across #20780 also, but it seems to be about handling dangling symlinks in the target (STATIC_ROOT), not the source (STATICFILES_DIRS).
comment:3 by , 11 years ago
Summary: | "collectstatic" fails when there is a dangling symlink → "collectstatic" fails when there is a dangling symlink (in the source) |
---|
comment:4 by , 10 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I think that's the correct behavior. "Errors shouldn't pass silently" -- PEP20.
A dangling symlink is an invalid input for the collectstatic process. It indicates a problem. Django cannot know what the proper resolution for this problem is.
If you still disagree, please start a discussion on the django-developers mailing list.
Is this really on master? #20780 seems like a duplicate which says it's fixed.