From 6ca163d7cc451fafd3015fa2ee735d5377fa3065 Mon Sep 17 00:00:00 2001 From: Alex Morozov Date: Fri, 20 Nov 2015 23:59:34 +0300 Subject: Fixed #25784 -- Prevented an exception on collectstatic help Made the `manage.py help collectstatic` don't fail if the `STATIC_ROOT` setting is empty. --- django/contrib/staticfiles/management/commands/collectstatic.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'django') diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py index e6b6198952..66dd782936 100644 --- a/django/contrib/staticfiles/management/commands/collectstatic.py +++ b/django/contrib/staticfiles/management/commands/collectstatic.py @@ -9,6 +9,7 @@ from django.core.files.storage import FileSystemStorage from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style from django.utils.encoding import smart_text +from django.utils.functional import cached_property from django.utils.six.moves import input @@ -28,12 +29,14 @@ class Command(BaseCommand): self.post_processed_files = [] self.storage = staticfiles_storage self.style = no_style() + + @cached_property + def local(self): try: self.storage.path('') except NotImplementedError: - self.local = False - else: - self.local = True + return False + return True def add_arguments(self, parser): parser.add_argument('--noinput', '--no-input', -- cgit v1.3