Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collectstatic -c fails since django 1.9 for s3 storage #112

xblitz opened this Issue Jan 17, 2016 · 1 comment


None yet
3 participants
Copy link

xblitz commented Jan 17, 2016

it seems that since django 1.9 specificaly this PR django/django@87d7824 it breaks the "collectstatic -c" since it tries to validate that the root directory exists (which is empty in out case) because the bucket.new_key fails if the key name is empty

In the case of django-storages, maybe we can check if the bucket exists or just return true if its empty? (I think I would go for the true if empty)

Here is the Traceback:

Traceback (most recent call last):
  File "", line 10, in <module>
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/", line 353, in execute_from_command_line
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/", line 345, in execute
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/", line 399, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/", line 176, in handle
    collected = self.collect()
  File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/", line 89, in collect
  File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/", line 210, in clear_dir
    if not
  File "/app/.heroku/python/lib/python3.4/site-packages/storages/backends/", line 433, in exists
    k = self.bucket.new_key(self._encode_name(name))
  File "/app/.heroku/python/lib/python3.4/site-packages/boto/s3/", line 622, in new_key
    raise ValueError('Empty key names are not allowed')
ValueError: Empty key names are not allowed

This comment has been minimized.

Copy link

jschneier commented Jan 23, 2016

Thanks for the report. I'm torn between the 2 possible fixes. From a strictly correctness standpoint I think that checking for bucket existence makes more sense. The only time that doesn't matter in this case is when you have set the setting AWS_AUTO_CREATE_BUCKET.

Side note: looks like we should be using get_key for checking existence.

@jschneier jschneier closed this in b95ec91 Jan 26, 2016

jschneier added a commit that referenced this issue Jan 26, 2016

@jleclanche jleclanche added the s3boto label Jun 5, 2017

@pyup-bot pyup-bot referenced this issue Aug 12, 2017


Initial Update #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.