From 99d6296b994d049a6ad8d3f13c0b3f2edda1a2fe Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 29 Aug 2012 15:39:03 -0400 Subject: [PATCH] Set the course static file dir to /static directories in course repos if the folder exists, and fall back to including the whole course folder otherwise --- lms/envs/common.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lms/envs/common.py b/lms/envs/common.py index ce08bf9666..61a3abab6d 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -260,12 +260,22 @@ STATICFILES_DIRS = [ PROJECT_ROOT / "askbot" / "skins", ] if os.path.isdir(DATA_DIR): + # Add the full course repo if there is no static directory STATICFILES_DIRS += [ # TODO (cpennington): When courses are stored in a database, this # should no longer be added to STATICFILES (course_dir, DATA_DIR / course_dir) for course_dir in os.listdir(DATA_DIR) - if os.path.isdir(DATA_DIR / course_dir) + if (os.path.isdir(DATA_DIR / course_dir) and + not os.path.isdir(DATA_DIR / course_dir / 'static')) + ] + # Otherwise, add only the static directory from the course dir + STATICFILES_DIRS += [ + # TODO (cpennington): When courses are stored in a database, this + # should no longer be added to STATICFILES + (course_dir, DATA_DIR / course_dir / 'static') + for course_dir in os.listdir(DATA_DIR) + if (os.path.isdir(DATA_DIR / course_dir / 'static')) ] # Locale/Internationalization