aboutsummaryrefslogtreecommitdiffstats
path: root/src/laas_dashboard
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-01-30 13:33:35 -0500
committerParker Berberian <pberberian@iol.unh.edu>2020-01-30 16:12:18 -0500
commit078273eb7db5a481a4131d44a943f3c9e34b6b88 (patch)
tree9e6e569e18712d77b8a65c6ebf4dda50ade1b55a /src/laas_dashboard
parent899e1a4baa95d0bc6f0eef34de66f0e257174878 (diff)
Adds Template Overrides
Changes the structure of the template directories to allow a new project to define their own set of override templates that inherit from a common base. I have slightly modified landing.html here as an example. In comming changes we will try to move all the "laas" specific content into the laas directory Change-Id: I46151be182de901f870debb247b305ea34ae77ba Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/laas_dashboard')
-rw-r--r--src/laas_dashboard/settings.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/laas_dashboard/settings.py b/src/laas_dashboard/settings.py
index 951ce1a..d41ad0c 100644
--- a/src/laas_dashboard/settings.py
+++ b/src/laas_dashboard/settings.py
@@ -53,10 +53,23 @@ MIDDLEWARE = [
ROOT_URLCONF = 'laas_dashboard.urls'
+TEMPLATE_OVERRIDE = os.environ.get("TEMPLATE_OVERRIDE_DIR", "") # the user's custom template dir
+TEMPLATE_DIRS = ["base"] # where all the base templates are
+
+# If the user has a custom template directory,
+# We should search that first. Then we search the
+# root template directory so that we can extend the base
+# templates within the custom template dir.
+if TEMPLATE_OVERRIDE:
+ TEMPLATE_DIRS = [TEMPLATE_OVERRIDE, ""] + TEMPLATE_DIRS
+
+# all template dirs are relative to /project_root/templates/
+dirs = [os.path.join(BASE_DIR, "templates", d) for d in TEMPLATE_DIRS]
+
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [os.path.join(BASE_DIR, 'templates')],
+ 'DIRS': dirs,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [