Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 13, 2022
1 parent bcd9e65 commit 16ca600
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/whitenoise/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import re
import warnings
from posixpath import normpath
from django.conf import settings
from wsgiref.headers import Headers
from wsgiref.util import FileWrapper

from django.conf import settings
from django.http import Http404

from .media_types import MediaTypes
Expand Down Expand Up @@ -152,15 +152,18 @@ def find_file(self, url):
pass

if settings.DEBUG and url.startswith(settings.STATIC_URL):
paths = '\n '.join(self.candidate_paths_for_url(url))
paths = "\n ".join(self.candidate_paths_for_url(url))
from django.contrib.staticfiles.finders import get_finders

finders = get_finders()
app_dirs = []
for finder in finders:
for storage in finder.storages.values():
app_dirs.append(storage.location)
app_dirs = '\n '.join(sorted(app_dirs))
raise MissingFileError(f"{url} not found. Searched these paths:\n\n {paths}\n\nApp dirs:\n\n {app_dirs}")
app_dirs = "\n ".join(sorted(app_dirs))
raise MissingFileError(
f"{url} not found. Searched these paths:\n\n {paths}\n\nApp dirs:\n\n {app_dirs}"
)

def candidate_paths_for_url(self, url):
for root, prefix in self.directories:
Expand Down

0 comments on commit 16ca600

Please sign in to comment.