How to return only the a file path in DO Spaces?

My django app saves user-uploaded files to my s3 bucket in DigitalOcean Spaces(using django-storages[s3], which is based on amazon-s3) and the path to the file is saved in my database. However when I click the url in located in the database it leads me to a page with this error: The request signature we calculated does not match the signature you provided. Check your key and signing method.

The actual url, for example, looks something like this: https://my-spaces.nyc3.digitaloceanspaces.com/media/uploads/Recording_2.mp3?AWSAccessKeyId=DO009ABCDEFGH&Signature=Y9tn%2FTZa6sVlGGZSU77tA%3D&Expires=1604202599. Ideally the url saved should be https://my-spaces.nyc3.digitaloceanspaces.com/media/uploads/Recording_2.mp3

This actually also impacts other parts of my project because the url will be accessed later using requests but because of this error I get status [402].

My settings.py is this:

AWS_ACCESS_KEY_ID = 'DO009ABCDEFGH'
AWS_SECRET_ACCESS_KEY = 'Nsecret_key'
AWS_STORAGE_BUCKET_NAME = 'bucket_name'
AWS_DEFAULT_ACL = 'public-read'
AWS_S3_ENDPOINT_URL = 'https://transcribe-spaces.nyc3.digitaloceanspaces.com/'
AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400'
}

AWS_MEDIA_LOCATION = 'media/'
PUBLIC_MEDIA_LOCATION = 'media/'
MEDIA_URL = '%s%s' % (AWS_S3_ENDPOINT_URL, AWS_MEDIA_LOCATION)
DEFAULT_FILE_STORAGE = 'mysite.storage_backends.MediaStorage'

The url that is saved contains the Access Key, the Signature that was used to write the file to the bucket and a timeout. I want all of that to not be there when the url to the file is saved in the database. I’ve tried to edit the MEDIA_URL, AWS_STORAGE_BUCKET_NAME and other settings but they either caused errors that broke the app or did nothing at all.

Hello there!
If your bucket is public, and you only have public content in there, you can set the aws_querystring_auth configuration to False to disable this, see the doc, and for where to put this configuration, here

In addition, i use a slightly different approach when i have both public/private objects on my bucket. I use two different storages classes, one for the public access and one for the private ones.