-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Version 5.0 breaks collectstatic when using some storage backends #2068
Comments
The debug toolbar doesn't appear in the traceback at all, only Django and django-storages and the google cloud library. Maybe changing the toolbar version installed or uninstalled something else, maybe a dependency? |
I agree with @matthiask.
Could you elaborate on this? Maybe we're missing something. |
Based on my analysis it seemed like when collectstatic is executed the Whenever I was facing this issue and tried disabling the debug toolbar (without changing any installed python packages), the issue disappeared. And after trying to track down the source of the issue I noticed in some places the passed storage object is a I am not an expert regarding the internals of debug toolbar so I might be missing something. But In general I thought probably the Thanks |
I think we're going to need your help identifying the problem here. If you can create a reproducible example for us that would be ideal. If that's not possible, it's unlikely we'll get to this. |
The issue may be reproduced by the following steps
I have managed to reproduce the issue using those steps. I have attached a minimal django project example that is could be used to reproduce the issue. If the issue can't be reproduced on your end and you strongly think it is a configuration issue feel to close the ticket. |
I have an idea what might be going on. We're reinstantiating the static files storage class here, probably losing some attributes in the process:
We could (and maybe should?) instead add a mixin to the MRO which wraps the class URLMixin:
def url(...):
...
configured_storage = storages["staticfiles"]
configured_storage.__class__.__bases__.insert(0, URLMixin) With the appropriate fallbacks and everything. Maybe there are better ways to implement this, but all we want is to see the static files for which URLs are generated. Alternatively, we would wrap the static files instance with a proxy which forwards everything to the wrapped instance, similar to how |
I'm doubting my own comment from above because we have been using the way of wrapping the static files storage for a really long time, that hasn't changed recently. So upgrading to 5.0 shouldn't have changed anything. |
@matthiask Based on my basic tests, It seems like #2069 is working as expected (i.e. collectstatic doesn't produce the error when using that version). |
@machakux Thanks for testing the change! |
When using Google Cloud Storage backend via django-storages running
./manage.py collectstatic
fails with someValueError
. Based on my analysis it seems the error has something to do withDebugStaticFilesStorage
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
...The text was updated successfully, but these errors were encountered: