0

I use django and serve media with digital ocean. Private files are uploaded to the private folder and media to the media folder. Everything works fine. The problem is when I try to use my custom domain. I want users to click on the file and get the file at media.mydomain.com and not sfo.digitalocean.com .

After I added the custom domain, I got an Access Denied if click to access media file.

<Error>
<Code>AccessDenied</Code>
<BucketName>exitma</BucketName>
<RequestId>tx000000000000046cc93c9-006358c390-213dd0f0-sfo3a</RequestId>
<HostId>213dd0f0-sfo3a-sfo3-zg01</HostId>
</Error>

If I include custom_domain=False in my storagebackend.py then media URL works but the access goes to digitalocean.com and not custom domain (media.mydomain.com). My question is....Is it possible for users to access private file via {{media.url}} at a custom domain instead of sfo3.digitaloceanspaces.com?

class PrivateMediaStorage(S3Boto3Storage):
    location = 'private'
    default_acl = 'private'
    file_overwrite = False
    custom_domain = False
sdg
  • 701
  • 1
  • 5
  • 12

0 Answers0