I setup my django application to use google cloud storage, via apache-libcloud and django-storages.
my LIBCLOUD_PROVIDER
looks something like this
LIBCLOUD_PROVIDERS = {
'default': {
'type': 'libcloud.storage.types.Provider.GOOGLE_STORAGE',
'bucket': 'bucket-name',
'user': os.environ.get('GCE_STORAGE_KEY'),
'key': os.environ.get('GCE_STORAGE_SECRET')
},
}
STATICFILES_STORAGE = 'etc.utilities.storage.GSStaticBucket'
It seems to work fine when I run ./manage.py collectstatic
and files get uploaded successfully. But am looking for a way to control the files access control; right now it uploads all files as private and instead want them uploaded to be publicly accessible.
But as you see from screenshot above. The uploaded files are not flagged for "Shared Publicly"
Can someone advise please?
You can set the default object access control on your bucket to give public read access to newly-created objects.
Apache Libcloud allows you to send extra headers with your request, and you can effect the same behavior by adding the x-goog-acl
header to the upload request. Their docs don't show it, but it's analogous to their S3 example.
However, it appears that django-storages's wrapping of libcloud doesn't allow for providing that data, so you'll likely have to rely on the bucket default object access control.