#23986: Collectstatic --clear fails if the static dir doesn't exist yet -------------------------------------+-------------------- Reporter: mvantellingen | Owner: nobody Type: Uncategorized | Status: new Component: contrib.staticfiles | Version: 1.7 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+-------------------- The --clear flag on collectstatic fails if the target directory doesn't exist yet.
{{{ Traceback (most recent call last): File "redacted/bin/manage.py", line 16, in <module> execute_from_command_line(sys.argv) File "redacted/local/lib/python2.7/site- packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "redacted/local/lib/python2.7/site- packages/django/core/management/__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "redacted/local/lib/python2.7/site- packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "redacted/local/lib/python2.7/site- packages/django/core/management/base.py", line 338, in execute output = self.handle(*args, **options) File "redacted/local/lib/python2.7/site- packages/django/core/management/base.py", line 533, in handle return self.handle_noargs(**options) File "redacted/local/lib/python2.7/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle_noargs collected = self.collect() File "redacted/local/lib/python2.7/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 89, in collect self.clear_dir('') File "redacted/local/lib/python2.7/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 202, in clear_dir dirs, files = self.storage.listdir(path) File "redacted/local/lib/python2.7/site- packages/django/core/files/storage.py", line 270, in listdir for entry in os.listdir(path): OSError: [Errno 2] No such file or directory: '/redacted/public/static/2.1.0-dev' }}} Adding {{{ if not os.path.exists(self.storage.location): return }}} In Command.clear_dir() fixes the issue -- Ticket URL: <https://code.djangoproject.com/ticket/23986> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/056.7b6e8e9fafd96f7d0ebcc691b991fc2a%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.