From 2b637fe5110996febeff0982e5c10ebc7159e4ce Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 7 Feb 2013 10:13:53 -0500 Subject: [PATCH] Fix loads of local static files when running in dev mode --- common/djangoapps/static_replace/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/djangoapps/static_replace/__init__.py b/common/djangoapps/static_replace/__init__.py index bf27f5b38d..d41688530e 100644 --- a/common/djangoapps/static_replace/__init__.py +++ b/common/djangoapps/static_replace/__init__.py @@ -77,9 +77,13 @@ def replace_static_urls(text, data_directory, course_namespace=None): # course_namespace is not None, then use studio style urls if course_namespace is not None and not isinstance(modulestore(), XMLModuleStore): url = StaticContent.convert_legacy_static_url(rest, course_namespace) + # In debug mode, if we can find the url as is, + elif settings.DEBUG and finders.find(rest, True): + return original # Otherwise, look the file up in staticfiles_storage, and append the data directory if needed else: course_path = "/".join((data_directory, rest)) + try: if staticfiles_storage.exists(rest): url = staticfiles_storage.url(rest)