Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
boxed committed Feb 13, 2022
1 parent bcd9e65 commit 6c391ef
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/whitenoise/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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.http import Http404
from django.conf import settings

from .media_types import MediaTypes
from .responders import IsDirectoryError, MissingFileError, Redirect, StaticFile
Expand Down Expand Up @@ -152,15 +151,20 @@ 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:
{paths}
App dirs:
{app_dirs}""")

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

0 comments on commit 6c391ef

Please sign in to comment.