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
gcloud raises NotFound exception on self.storage.url(self.name) #463
Comments
Hi! We have been hitting the same problem. When URL is built, _get_blob() is called and raises a NotFound exception if file does not exists. As a workaround, we wrote a CustomImageField that builds the URL in case the file doesn't exist, but _get_blob() is always executed. I also realized it introduces some overhead when listing objects with images. Is it possible that the reason is the execution of _get_blob() connecting to GCS? |
@zisk0 Yes. get_blob connects to GCS. I do not think it should unless you need the file retrieved for writes, reads, etc. |
AFAIK it is to obtain the public_url of the blob. We were working to control this URL using:
Where self.base_url is a setting:
This is also a workaround for #385. Now load speed has been improved. |
All of this discussion is now ongoing in #491. |
I am serializing an ImageFileField with Django RestFramework. If the file does not exist it raises NotFound().
I am not sure how the other network storage layers work, but this is not how the file storage in Django core works it will simply return a URL.
I suggest the code be changed to return the URL without checking to see if the blob exists.
The text was updated successfully, but these errors were encountered: