summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/staticfiles/finders.py2
-rw-r--r--django/contrib/staticfiles/storage.py14
2 files changed, 12 insertions, 4 deletions
diff --git a/django/contrib/staticfiles/finders.py b/django/contrib/staticfiles/finders.py
index 7d266d95a0..6dfa31bd2b 100644
--- a/django/contrib/staticfiles/finders.py
+++ b/django/contrib/staticfiles/finders.py
@@ -57,7 +57,7 @@ class FileSystemFinder(BaseFinder):
prefix, root = root
else:
prefix = ''
- if os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):
+ if settings.STATIC_ROOT and os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(root):
raise ImproperlyConfigured(
"The STATICFILES_DIRS setting should "
"not contain the STATIC_ROOT setting")
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index 0269f6f782..7e0b8f0403 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -32,13 +32,21 @@ class StaticFilesStorage(FileSystemStorage):
location = settings.STATIC_ROOT
if base_url is None:
base_url = settings.STATIC_URL
+ check_settings(base_url)
+ super(StaticFilesStorage, self).__init__(location, base_url,
+ *args, **kwargs)
+ # FileSystemStorage fallbacks to MEDIA_ROOT when location
+ # is empty, so we restore the empty value.
if not location:
+ self.base_location = None
+ self.location = None
+
+ def path(self, name):
+ if not self.location:
raise ImproperlyConfigured("You're using the staticfiles app "
"without having set the STATIC_ROOT "
"setting to a filesystem path.")
- check_settings(base_url)
- super(StaticFilesStorage, self).__init__(location, base_url,
- *args, **kwargs)
+ return super(StaticFilesStorage, self).path(name)
class CachedFilesMixin(object):