|
@@ -4,7 +4,7 @@ import os
|
|
|
from django.apps import apps
|
|
|
from django.conf import settings
|
|
|
from django.contrib.staticfiles import utils
|
|
|
-from django.core.checks import Error
|
|
|
+from django.core.checks import Error, Warning
|
|
|
from django.core.exceptions import ImproperlyConfigured
|
|
|
from django.core.files.storage import (
|
|
|
FileSystemStorage, Storage, default_storage,
|
|
@@ -91,6 +91,12 @@ class FileSystemFinder(BaseFinder):
|
|
|
'STATIC_ROOT setting.',
|
|
|
id='staticfiles.E002',
|
|
|
))
|
|
|
+ if not os.path.isdir(root):
|
|
|
+ errors.append(Warning(
|
|
|
+ f"The directory '{root}' in the STATICFILES_DIRS setting "
|
|
|
+ f"does not exist.",
|
|
|
+ id='staticfiles.W004',
|
|
|
+ ))
|
|
|
return errors
|
|
|
|
|
|
def find(self, path, all=False):
|
|
@@ -127,9 +133,11 @@ class FileSystemFinder(BaseFinder):
|
|
|
List all files in all locations.
|
|
|
"""
|
|
|
for prefix, root in self.locations:
|
|
|
- storage = self.storages[root]
|
|
|
- for path in utils.get_files(storage, ignore_patterns):
|
|
|
- yield path, storage
|
|
|
+ # Skip nonexistent directories.
|
|
|
+ if os.path.isdir(root):
|
|
|
+ storage = self.storages[root]
|
|
|
+ for path in utils.get_files(storage, ignore_patterns):
|
|
|
+ yield path, storage
|
|
|
|
|
|
|
|
|
class AppDirectoriesFinder(BaseFinder):
|