Ticket #15094: staticfiles_dirs_to_tuple.diff

File staticfiles_dirs_to_tuple.diff, 839 bytes (added by Elmar Athmer, 14 years ago)

convert STATICFILES_DIRS into tuple if set as string

  • django/contrib/staticfiles/finders.py

     
    4747        self.storages = SortedDict()
    4848        # Set of locations with static files
    4949        self.locations = set()
    50         for root in settings.STATICFILES_DIRS:
     50
     51        # staticfiles_dirs should be converted into tuple if mistakenly
     52        # entered as string (i.e. user forgot the comma)
     53        staticfiles_dirs = (settings.STATICFILES_DIRS,) if type(
     54                settings.STATICFILES_DIRS) == str else settings.STATICFILES_DIRS
     55
     56        for root in staticfiles_dirs:
    5157            if isinstance(root, (list, tuple)):
    5258                prefix, root = root
    5359            else:
Back to Top