[TNL-4073][TNL-4273] Make sure that domain defined for preview exists in
HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS,
This commit is contained in:
@@ -78,4 +78,5 @@ def in_preview_mode():
|
||||
Returns whether the user is in preview mode or not.
|
||||
"""
|
||||
hostname = get_current_request_hostname()
|
||||
return bool(hostname and settings.PREVIEW_DOMAIN in hostname.split('.'))
|
||||
preview_lms_base = settings.FEATURES.get('PREVIEW_LMS_BASE', None)
|
||||
return bool(preview_lms_base and hostname and hostname.split(':')[0] == preview_lms_base.split(':')[0])
|
||||
|
||||
@@ -405,6 +405,13 @@ if 'DJFS' in AUTH_TOKENS and AUTH_TOKENS['DJFS'] is not None:
|
||||
|
||||
############### Module Store Items ##########
|
||||
HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS = ENV_TOKENS.get('HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS', {})
|
||||
# PREVIEW DOMAIN must be present in HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS for the preview to show draft changes
|
||||
if 'PREVIEW_LMS_BASE' in FEATURES and FEATURES['PREVIEW_LMS_BASE'] != '':
|
||||
PREVIEW_DOMAIN = FEATURES['PREVIEW_LMS_BASE'].split(':')[0]
|
||||
# update dictionary with preview domain regex
|
||||
HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS.update({
|
||||
PREVIEW_DOMAIN: 'draft-preferred'
|
||||
})
|
||||
|
||||
############### Mixed Related(Secure/Not-Secure) Items ##########
|
||||
LMS_SEGMENT_KEY = AUTH_TOKENS.get('SEGMENT_KEY')
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
"ENABLE_S3_GRADE_DOWNLOADS": true,
|
||||
"ENABLE_THIRD_PARTY_AUTH": true,
|
||||
"ENABLE_COMBINED_LOGIN_REGISTRATION": true,
|
||||
"PREVIEW_LMS_BASE": "localhost:8003",
|
||||
"PREVIEW_LMS_BASE": "preview.localhost:8003",
|
||||
"ALLOW_AUTOMATED_SIGNUPS": true,
|
||||
"AUTOMATIC_AUTH_FOR_TESTING": true,
|
||||
"MODE_CREATION_FOR_TESTING": true,
|
||||
|
||||
@@ -2667,9 +2667,6 @@ PROFILE_IMAGE_SECRET_KEY = 'placeholder secret key'
|
||||
PROFILE_IMAGE_MAX_BYTES = 1024 * 1024
|
||||
PROFILE_IMAGE_MIN_BYTES = 100
|
||||
|
||||
# This is to check the domain in case of preview.
|
||||
PREVIEW_DOMAIN = 'preview'
|
||||
|
||||
# Sets the maximum number of courses listed on the homepage
|
||||
# If set to None, all courses will be listed on the homepage
|
||||
HOMEPAGE_COURSE_MAX = None
|
||||
|
||||
@@ -394,6 +394,14 @@ YOUTUBE_PORT = 8031
|
||||
LTI_PORT = 8765
|
||||
VIDEO_SOURCE_PORT = 8777
|
||||
|
||||
FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost"
|
||||
############### Module Store Items ##########
|
||||
PREVIEW_DOMAIN = FEATURES['PREVIEW_LMS_BASE'].split(':')[0]
|
||||
HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS = {
|
||||
PREVIEW_DOMAIN: 'draft-preferred'
|
||||
}
|
||||
|
||||
|
||||
################### Make tests faster
|
||||
|
||||
#http://slacy.com/blog/2012/04/make-your-tests-faster-in-django-1-4/
|
||||
|
||||
Reference in New Issue
Block a user