Commit 54594de9 by Sef Kloninger

enable theming via external "theme" directory

This is compatible with the existing theming for LMS.
parent 65b73864
......@@ -2,6 +2,7 @@ from datetime import timedelta
import logging
import os
import platform
from theming import enable_theme
DATABASES = {
'default': {
......@@ -86,6 +87,11 @@ LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO')
# datadog
DATADOG_API_KEY = os.getenv('DATADOG_API_KEY')
# Theme
THEME_NAME = os.getenv('THEME_NAME', None)
if THEME_NAME is not None:
enable_theme(THEME_NAME)
# celery
import djcelery
djcelery.setup_loader()
......
def enable_theme(theme_name):
"""
Enable the settings for a custom theme, whose files should be stored
in ENV_ROOT/themes/THEME_NAME (e.g., edx_all/themes/stanford).
The THEME_NAME setting should be configured separately since it can't
be set here (this function closes too early). An idiom for doing this
is:
THEME_NAME = os.getenv('THEME_NAME', None)
enable_theme(THEME_NAME)
"""
# Calculate the location of the theme's files
theme_root = ENV_ROOT + "/themes/" + theme_name
# Include the theme's templates in the template search paths
try:
TEMPLATE_DIRS
except NameError:
TEMPLATE_DIRS = [
os.path.join(PROJECT_ROOT, "templates/"),
]
TEMPLATE_DIRS.insert(0, theme_root + "templates/")
# Namespace the theme's static files to 'themes/<theme_name>' to
# avoid collisions with default edX static files
try:
STATICFILES_DIRS
except NameError:
STATICFILES_DIRS = [
os.path.join(PROJECT_ROOT, "static/"),
]
STATICFILES_DIRS.insert(0, ("themes/%s" % theme_name, theme_root + "/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