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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user