def _find_filepath_in_roots(filename):
for root in settings.DJANGO_STATIC_MEDIA_ROOTS:<EOL><INDENT>filepath = _filename2filepath(filename, root)<EOL>if os.path.isfile(filepath):<EOL><INDENT>return filepath, root<EOL><DEDENT><DEDENT>if settings.DEBUG:<EOL><INDENT>try:<EOL><INDENT>from django.contrib.staticfiles import finders<EOL>absolute_path = finders.find(filename)<EOL>if absolute_path:<EOL><INDENT>root, filepath = os.path.split(absolute_path)<EOL>return absolute_path, root<EOL><DEDENT><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return None, None<EOL>
Look for filename in all MEDIA_ROOTS, and return the first one found.