Skip to content

Commit

Permalink
use contrib.staticfiles.finders if available and in DEBUG mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacrymology committed Jun 18, 2012
1 parent 11b7c57 commit 34c5c83
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions django_static/templatetags/django_static.py
Expand Up @@ -632,6 +632,16 @@ def _find_filepath_in_roots(filename):
filepath = _filename2filepath(filename, root)
if os.path.isfile(filepath):
return filepath, root
# havent found it in DJANGO_STATIC_MEDIA_ROOTS look for apps' files if we're
# in DEBUG mode
if settings.DEBUG:
try:
from django.contrib.staticfiles import finders
absolute_path = finders.find(filename)
root, filepath = os.path.split(absolute_path)
return absolute_path, root
except ImportError:
pass
return None, None

def _filename2filepath(filename, media_root):
Expand Down

0 comments on commit 34c5c83

Please sign in to comment.