diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 5d17d9c157..32a4c97551 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -86,8 +86,12 @@ CELERY_QUEUES = { with open(CONFIG_ROOT / CONFIG_PREFIX + "env.json") as env_file: ENV_TOKENS = json.load(env_file) -# STATIC_URL specifies the url to use for static files -STATIC_URL = ENV_TOKENS.get('STATIC_URL', STATIC_URL) +# STATIC_URL_BASE specifies the base url to use for static files +STATIC_URL_BASE = ENV_TOKENS.get('STATIC_URL_BASE', None) +if STATIC_URL_BASE: + # collectstatic will fail if STATIC_URL is a unicode string + STATIC_URL = STATIC_URL_BASE.encode('ascii', 'ignore') + "/" + git.revision + "/" + # GITHUB_REPO_ROOT is the base directory # for course data GITHUB_REPO_ROOT = ENV_TOKENS.get('GITHUB_REPO_ROOT', GITHUB_REPO_ROOT) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index b6e47d6ab1..a1146c6c84 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -108,8 +108,12 @@ STATIC_ROOT_BASE = ENV_TOKENS.get('STATIC_ROOT_BASE', None) if STATIC_ROOT_BASE: STATIC_ROOT = path(STATIC_ROOT_BASE) -# STATIC_URL specifies the url to use for static files -STATIC_URL = ENV_TOKENS.get('STATIC_URL', STATIC_URL) + +# STATIC_URL_BASE specifies the base url to use for static files +STATIC_URL_BASE = ENV_TOKENS.get('STATIC_URL_BASE', None) +if STATIC_URL_BASE: + # collectstatic will fail if STATIC_URL is a unicode string + STATIC_URL = STATIC_URL_BASE.encode('ascii', 'ignore') + "/" PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', PLATFORM_NAME) # For displaying on the receipt. At Stanford PLATFORM_NAME != MERCHANT_NAME, but PLATFORM_NAME is a fine default