Linode Object Storage Python sdk

I am trying to use Linode Object Storage to serve my Django static files with the same configuration used in s3, but it seems to work on s3 and not in Linode Object Storage, can anyone help me with that, please? providing a good SDK to work with would be nice, Thanks!

6 Replies

We would like to help get you pointed in the right direction. Before we can offer any advice we'll need some additional information from you on what you're trying to accomplish. Can you provide the code or script you're using that is working with s3, but isn't with our s3 compatible Object Storage?

What parameters are you using when making calls to Linode Object Storage? Also, how are you initializing your connection to Linode Object Storage? These are a few things we may need so we can help you further. Any additional information that you can provide would help us immensely.

I've also included links to some of our Linode Object Storage guides below that may help.

How to Use Linode Object Storage
Accessing Objects with Linode Object Storage
Host a Static Site using Linode Object Storage
Linode API | Object Storage | Linode Developer Tools

@mcivitarese I'm about to use Object Storage with Django too, and can't find any information or tutorials.

I would expect something like this to work: https://blog.theodo.com/2019/07/aws-s3-upload-django/

But it would be good to see a Django-specific tutorial coming from Linode.

Hi there, I'm using Django Storages, boto3 with a configuration like below which seems to work (though lately I've been having intermittent issues when uploading files):

One thing I've noticed is that object storage adds the bucket name to the end of the URL when fetching files so your AWS_S3_CUSTOM_DOMAIN will end up looking like "mybucket.ap-south-1.linodeobjects.com/mybucket" and the AWS_S3_ENDPOINT_URL will just be "https://mybucket.ap-south-1.linodeobjects.com/"

I hope this helps.

AWS_STORAGE_BUCKET_NAME = 'thrive'
AWS_ACCESS_KEY_ID = '--access key--'
AWS_SECRET_ACCESS_KEY = '--secret-key--'
AWS_S3_CUSTOM_DOMAIN = '%s.ap-south-1.linodeobjects.com/%s' % (AWS_STORAGE_BUCKET_NAME, AWS_STORAGE_BUCKET_NAME)
MEDIA_URL = "https://%s/" % (AWS_S3_CUSTOM_DOMAIN,)
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_S3_ENDPOINT_URL = "https://%s.ap-south-1.linodeobjects.com/" % AWS_STORAGE_BUCKET_NAME

This video was very usefull. I can conect with the bucket using Django and Boto3

[https://www.youtube.com/watch?v=oAn7isP5Osg&t=716s]

However, all my images are added to the bucket with private access, so I have to go and change permission manualy for each one. Changing the settings on linode web admin panel is not having any effect.

Originally I had back-ported the boto storages backend and finding it easier to debug was able to get it to work.

After checking out the above video mentioned by @gabospa however I found very helpful. I managed to get it working with the boto3 backend.

I had none of the mentioned issues with permissions - I suspect those have been addressed in recent changes and now it seems to work as expected.

David

@gabospa you probably discovered the solution to access problem already, but in case anyone else has the same issue (and you will if you're using your bucket to serve data for a public facing web site), check out this community post:

https://www.linode.com/community/questions/19796/public-read-access-for-object-storage-bucket

It's a little mysterious as to why this setting isn't available in the Linode web UI since it seems like it is a very common use case. Defaulting to private is fine and secure, but an option to change this easily in a more obvious way would be good.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct