Exemple #1
0
 def __init__(self, apps=None, *args, **kwargs):
     # List of locations with static files
     self.locations = []
     # Maps dir paths to an appropriate storage instance
     self.storages = SortedDict()
     if not isinstance(settings.STATICFILES_DIRS, (list, tuple)):
         raise ImproperlyConfigured(
             "Your STATICFILES_DIRS setting is not a tuple or list; "
             "perhaps you forgot a trailing comma?")
     for root in settings.STATICFILES_DIRS:
         if isinstance(root, (list, tuple)):
             prefix, root = root
         else:
             prefix = ''
         if os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):
             raise ImproperlyConfigured(
                 "The STATICFILES_DIRS setting should "
                 "not contain the STATIC_ROOT setting")
         if (prefix, root) not in self.locations:
             self.locations.append((prefix, root))
     for prefix, root in self.locations:
         filesystem_storage = FileSystemStorage(location=root)
         filesystem_storage.prefix = prefix
         self.storages[root] = filesystem_storage
     super(FileSystemFinder, self).__init__(*args, **kwargs)