'How to Delete the Digital Ocean Space Image from Python Django

Please let me know any reference or sample code to how to delete the Digital Ocean Space Image from Python Django, There is example for list and upload the image in Space Image.

Please help me to find the way for my solution

Getting Error like: 'S3' object has no attribute 'delete_file'

Please refer sample code like this

session = boto3.session.Session()
client = session.client('s3',
                        region_name='nyc3',
                        endpoint_url='https://nyc3.digitaloceanspaces.com',
                        aws_access_key_id='********',
                        aws_secret_access_key='********')
client.delete_file('inspxotestspace',  # Name of Space
                    imagename1)  # Name for remote file

Thanks in advance,

Regards, Kishore



Solution 1:[1]

Presumably you mean delete_object rather than delete_file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Roseman