From 2f90b27707b946e3a7ffc455fbd801df9e09a536 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 10 Jul 2012 13:56:51 -0400 Subject: [PATCH] Only load DATA_DIR subdirs if DATA_DIR exists (so not during tests) --- lms/envs/common.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lms/envs/common.py b/lms/envs/common.py index 12d058f06f..05a1ba4b30 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -176,12 +176,14 @@ STATICFILES_DIRS = [ PROJECT_ROOT / "static", ASKBOT_ROOT / "askbot" / "skins", -] + [ - # 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): + 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) + ] # Locale/Internationalization TIME_ZONE = 'America/New_York' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name