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 current implementation assigns
OssMediaStorage.location
fromsettings.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,
settings.OSS_MEDIA_LOCALTION = '/media/'
settings.OSS_STATIC_LOCALTION = '/static/'
MEDIA_URL
orSTATIC_URL
when available, otherwise fallback to standard oss url.The pull request https://github.com/aliyun/django-oss-storage/pull/16 is based on pull request https://github.com/aliyun/django-oss-storage/pull/10 from @jxltom, which added public, public-read acl support.