Consider addition of endpoint to get direct upload URLs #28
Labels
decision needed
A decision is required (e.g. on UX or company policy)
feature
A new feature of the app
Feature request
Current state
When using BlobField to upload blobs to GCS, the upload is made to a temporary file, with a fixed content-type (application/octet-stream). Then, on successful commit of the transaction (ie once the corresponding row is saved in the database) the temporary blob is assigned its metadata and moved to its ultimate destination.
This is good because:
_tmp/
directory (or another bucket entirely) so are easily cleaned later.However, this mechanism limits you to uploading files using BlobField.
Use Case
I want to upload files from another service directly to GCS, using django-gcp as the permissions manager to sign URLs but without registering the files in BlobField
Proposed Solution
Create an endpoint to sign URLS that's accessible by the frontend, given a signing token. Thus the frontend can
Add a view like the following to
storage/views.py
:Then use this code snippet to generate the token and URL enabling the frontend to call the signing endpoint (in
storage/utils.py
):Finally, add the corresponding URL (
urlss.py
):The text was updated successfully, but these errors were encountered: