def delete_picture_from_s3(self, uuid): # check auth to delete photo try: conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) bucket = conn.get_bucket(bucket_name) # go through each version of the file key = '%s.jpg' % uuid fn = '%s.jpg' % uuid k = Key(bucket) k.delete_key(key) # we need to make it public so it can be accessed publicly # using a URL like http://s3.amazonaws.com/bucket_name/key # remove the file from the web server except: return HttpResponse(status=500)