Skip to content

Proposal to make django-oss-storage work with aliyun CDN #15

@favoyang

Description

@favoyang

The current implementation assigns OssMediaStorage.location from settings.MEDIA_URL (default value is '/media/'), and use that to construct the OSS URL. This is semi-correct, unless you work with aliyun CDN which use your domain as MEDIA_URL (for example, MEDIA_URL = 'https://files.yourdomain.com/').

Proposal,

  • Add settings.OSS_MEDIA_LOCALTION = '/media/'
  • Add settings.OSS_STATIC_LOCALTION = '/static/'
  • For private acl bucket, use signed_url
  • For public / public-read acl buckets, use MEDIA_URL or STATIC_URL when available, otherwise fallback to standard oss url.

The pull request #16 is based on pull request #10 from @jxltom, which added public, public-read acl support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions