jschneier / django-storages

https://django-storages.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.75k stars 859 forks source link

Skip actual file upload AWS S3 #434

Open palanshagarwal opened 6 years ago

palanshagarwal commented 6 years ago

I need to reduce my server load. For this I plan to upload large videos directly to s3 from client browser. Now I need to make a DB entry for the same in my django application using django-storages so that I can easily manage that file in future. Is there any way to manually give a s3 file key/url to FileField without actual file upload taking place?

folt commented 6 years ago

I have the same problem but with google cloud

onekiloparsec commented 6 years ago

Same problem here. Currently trying out various solutions... Will post it here if I find something.

folt commented 6 years ago

The source of this problem is in this line. Perhaps it makes sense to make settings that allow you to specify the actual file upload. public_url It is possible to get by adding from the app_id + url

onekiloparsec commented 6 years ago

The line you mention is in the GoogleCloud backend, not Amazon's. But I guess the problem is true everywhere.

onekiloparsec commented 6 years ago

You might be interested in my QA: https://stackoverflow.com/questions/50621968/how-to-use-django-filefield-with-dynamic-amazon-s3-bucket

folt commented 6 years ago

https://github.com/jschneier/django-storages/blob/master/storages/backends/gcloud.py#L248 this action can be made optional, obtaining _get_blob may not be expedient in my opinion

jschneier commented 6 years ago

So for public blobs on Google we have discussion ongoing in #491.