Skip to content
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

upload files to subdirectory #16

Open
AdrienLemaire opened this issue Aug 19, 2018 · 2 comments
Open

upload files to subdirectory #16

AdrienLemaire opened this issue Aug 19, 2018 · 2 comments

Comments

@AdrienLemaire
Copy link

AdrienLemaire commented Aug 19, 2018

@strayer hi, I was looking for a subdirectory option, but it seems it's not implemented in this package yet (related to #2)
We have the following use-case:

  • Join https://bucket_url/ with file_path for static files
  • Join https://bucket_url/uploads/ with file_path for media files.

Until now, I was juggling different data on local env (without gcloud storage) and staging where data paths were saved using /uploads/ prefix in db. But We messed up something, and staging data got saved in / , resulting in entities data being saved in 2 different locations (eg /uploads/users/1/image.jpg and /users/2/image.jpg).

I would like our data to behave consistently no matter the environment (ie do not save image paths with uploads/ prefix in db.

How would you go about uploading a file to https://bucket_url/uploads/users/3/image.jpg while saving /users/3/image.jpg in that user db row ?

Thanks for the support!
Cordially
Adrien

@AdrienLemaire
Copy link
Author

django-storages[google] has a GS_LOCATION setting available. I'm not sure yet how to only use that option when uploading files, but if there's no solution available in django-gcloud-storage, I'll try migrating to that other package :)

@strayer
Copy link
Owner

strayer commented Jun 27, 2019

Hey, sorry for not responding last year :/ I initially planned to implement this, but never came around actually doing it, so there is a bit of unfinished code on this topic. This would be a useful feature, but I can't commit much time to this project for the time being. If anyone wants to help with this, feel free to open a pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants