1

I created a s3 space with Digitalocean. I upload files into this one with ckeditor in a django project. I have no problem for uploading files but I meet a problem when I try to browse my server (to see if an image is already present)

Here is my code:

session = boto3.session.Session()
client = session.client('s3', region_name='fra1', 
                              endpoint_url=settings.AWS_S3_ENDPOINT_URL,
                              aws_access_key_id=settings.AWS_ACCESS_KEY_ID, 
                              aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY
                        )

resp = client.list_objects(Bucket=settings.AWS_STORAGE_BUCKET_NAME)

And an error happend the line where I call the function list_objects

An error occurred (NoSuchKey) when calling the ListObjects operation: Unknown

That's really stranger because I'm sure my settings.AWS_STORAGE_BUCKET_NAME is the correct one. Furthermore I'm sure there is no error in session.client because I use the same for uploading files, which works perfectly.

To make sure my bucket is the correct one I go to my AWS_S3_ENDPOINT_URL and got an XML with

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>[MY BUCKET NAME]</Name>
<Prefix/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>

And after that begins a list of <Contents>

Thank you for your help

LucieDevGirl
  • 177
  • 10
  • 1
    `"http://s3.amazonaws.com/` is AWS endpoint, not DO. Can you clarify what do you want to do? Also what is the value of `settings.AWS_S3_ENDPOINT_URL`? – Marcin Feb 16 '21 at 11:23
  • I want to list all the files stored on my digital ocean space. Yes its AWS endpoint but spaces delivered by digital ocean are s3 spaces. I can't give you my AWS_S3_ENDPOINT_URL because its public for now but I can ensure you that I give the good one, because I get a success when uploading documents – LucieDevGirl Feb 16 '21 at 14:21
  • may have you an advice ? according that Im using the correct endpoint – LucieDevGirl Feb 24 '21 at 13:57

0 Answers0