Commit 1105ad0e by Tyler Hallada Committed by GitHub

Use Cloudfront CDN for static assets in production environments (#699)

* Change STATIC_URL to Cloudfront in prod

* Set STATIC_URL when INSIGHTS_CLOUDGFRONT defined

* Use CLOUDFRONT_DOMAIN var instead

* Rename CLOUDFRONT to CDN in var name

* Initialize CDN_DOMAIN to None in base.py
parent eec242d3
...@@ -461,3 +461,7 @@ LEARNER_API_LIST_DOWNLOAD_FIELDS = None ...@@ -461,3 +461,7 @@ LEARNER_API_LIST_DOWNLOAD_FIELDS = None
########## CACHE CONFIGURATION ########## CACHE CONFIGURATION
COURSE_SUMMARIES_CACHE_TIMEOUT = 3600 # 1 hour timeout COURSE_SUMMARIES_CACHE_TIMEOUT = 3600 # 1 hour timeout
########## END CACHE CONFIGURATION ########## END CACHE CONFIGURATION
########## CDN CONFIGURATION
CDN_DOMAIN = None # production will not use a CDN for static assets if this is set to a falsy value
########## END CDN CONFIGURATION
...@@ -43,3 +43,7 @@ FULL_APPLICATION_NAME = u'{0} {1}'.format(PLATFORM_NAME, APPLICATION_NAME) ...@@ -43,3 +43,7 @@ FULL_APPLICATION_NAME = u'{0} {1}'.format(PLATFORM_NAME, APPLICATION_NAME)
# Depends on DOCUMENTATION_LOAD_ERROR_URL, so evaluate at the end # Depends on DOCUMENTATION_LOAD_ERROR_URL, so evaluate at the end
DOCUMENTATION_LOAD_ERROR_MESSAGE = 'This data may not be available for your course. ' \ DOCUMENTATION_LOAD_ERROR_MESSAGE = 'This data may not be available for your course. ' \
'<a href="{error_documentation_link}" target="_blank">Read more</a>.'.format(error_documentation_link=DOCUMENTATION_LOAD_ERROR_URL) '<a href="{error_documentation_link}" target="_blank">Read more</a>.'.format(error_documentation_link=DOCUMENTATION_LOAD_ERROR_URL)
# Use Cloudfront CDN for assets
if CDN_DOMAIN:
STATIC_URL = 'https://' + CDN_DOMAIN + '/static/'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment