Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Use Cloudfront CDN for static assets in production environments (#699)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
thallada authored Jun 30, 2017
1 parent eec242d commit 1105ad0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions analytics_dashboard/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,7 @@
########## CACHE CONFIGURATION
COURSE_SUMMARIES_CACHE_TIMEOUT = 3600 # 1 hour timeout
########## 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
4 changes: 4 additions & 0 deletions analytics_dashboard/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@
# Depends on DOCUMENTATION_LOAD_ERROR_URL, so evaluate at the end
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)

# Use Cloudfront CDN for assets
if CDN_DOMAIN:
STATIC_URL = 'https://' + CDN_DOMAIN + '/static/'

0 comments on commit 1105ad0

Please sign in to comment.