Add "AWS_S3_CUSTOM_DOMAIN" for S3 Media Backend CDN support
This commit is contained in:
parent
adf245b416
commit
da3c0d5bbf
|
@ -372,6 +372,9 @@ if SETUP.MEDIA_BACKEND:
|
||||||
if parsed.hostname is not None:
|
if parsed.hostname is not None:
|
||||||
port = parsed.port or 443
|
port = parsed.port or 443
|
||||||
AWS_S3_ENDPOINT_URL = f"https://{parsed.hostname}:{port}"
|
AWS_S3_ENDPOINT_URL = f"https://{parsed.hostname}:{port}"
|
||||||
|
if SETUP.MEDIA_URL is not None:
|
||||||
|
media_url_parsed = urllib.parse.urlparse(SETUP.MEDIA_URL)
|
||||||
|
AWS_S3_CUSTOM_DOMAIN = media_url_parsed.hostname
|
||||||
elif parsed.scheme == "local":
|
elif parsed.scheme == "local":
|
||||||
if not (MEDIA_ROOT and MEDIA_URL):
|
if not (MEDIA_ROOT and MEDIA_URL):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|
Loading…
Reference in New Issue