Digital Ocean Spaces and Django: Can upload but not open/check if the file exists
I am able to upload to my digital ocean space using my api key from my django app on python 3.10.13. I can see the files as well as open the hyperlinks to them successfully. Images that get uploaded show up on my site as expected.
I made all the files public, I've made and re-made my api-keys, I've made my own Media Storage class (I was able to backdoor the functionality by using the response library but that was very slow). I disabled the CDN in case that was interfering. I've re-arranged my folder structure. Tried CORS allow *. Below is the relevant code I am working with.
... CREDS ABOVE
AWS_S3_ENDPOINT_URL = config["remote_storage"]["AWS_S3_ENDPOINT_URL"]
AWS_LOCATION = 'media'
AWS_QUERYSTRING_AUTH = False # Set to False if files are public
MEDIA_URL = f"https://{AWS_S3_ENDPOINT_URL}/{AWS_LOCATION}/"
DEFAULT_FILE_STORAGE = 'spyglass.storage_backends.MediaStorage'
class MediaStorage(S3Boto3Storage):
location = 'media'
default_acl = 'public-read'
querystring_auth = False
def exists(self, name):
print(f"Checking if {self.url(name)} exists")
return super().exists(name)
The link that is printed works without a problem however the exists returns False.
I've been scratching my head for 2 days and could really use a nudge in the right direction as this is all new to me.