Open
Description
When using Google Cloud Storage backend via django-storages running ./manage.py collectstatic
fails with some ValueError
. Based on my analysis it seems the error has something to do with DebugStaticFilesStorage
objects from debug toolbar 5. Downgrading to version 4.4.* seems to solve the issue.
The issue can be encounteres when using
django-debug-toolbar==5.0.1
Django==5.1.5
django-storages[google]==1.14.4
A sample error returned by ./manage.py collectstatic
...
File "./manage.py", line 22, in <module>
main()
File "./manage.py", line 18, in main
execute_from_command_line(sys.argv)
File ".virtualenvs/test/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File ".virtualenvs/test/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File ".virtualenvs/test/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File ".virtualenvs/test/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
File ".virtualenvs/test/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
collected = self.collect()
File ".virtualenvs/test/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
handler(path, prefixed_path, storage)
File ".virtualenvs/test/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 378, in copy_file
self.storage.save(prefixed_path, source_file)
File ".virtualenvs/test/lib/python3.10/site-packages/django/core/files/storage/base.py", line 49, in save
name = self._save(name, content)
File ".virtualenvs/test/lib/python3.10/site-packages/storages/backends/gcloud.py", line 192, in _save
file_object = GoogleCloudFile(name, "rw", self)
File ".virtualenvs/test/lib/python3.10/site-packages/storages/backends/gcloud.py", line 45, in __init__
self.blob = storage.bucket.get_blob(name, chunk_size=storage.blob_chunk_size)
File ".virtualenvs/test/lib/python3.10/site-packages/google/cloud/storage/bucket.py", line 1268, in get_blob
blob.reload(
File ".virtualenvs/test/lib/python3.10/site-packages/google/cloud/storage/_helpers.py", line 247, in reload
self.path,
File ".virtualenvs/test/lib/python3.10/site-packages/google/cloud/storage/blob.py", line 334, in path
return self.path_helper(self.bucket.path, self.name)
File ".virtualenvs/test/lib/python3.10/site-packages/google/cloud/storage/bucket.py", line 1173, in path
raise ValueError("Cannot determine path without bucket name.")
ValueError: Cannot determine path without bucket name.
Metadata
Assignees
Labels
No labels