From f3a9c719fe8cdbc06440dde63fe2011b3fa5c6ce Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 30 Jan 2011 23:29:31 +0000 Subject: [PATCH] Added check to the staticfiles app to make sure the STATIC_ROOT setting isn't accidentally added to the STATICFILES_DIRS setting. Thanks for the suggestion, SmileyChris and harijay. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15376 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/staticfiles/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django/contrib/staticfiles/utils.py b/django/contrib/staticfiles/utils.py index e7598d4aa5..217bc7a706 100644 --- a/django/contrib/staticfiles/utils.py +++ b/django/contrib/staticfiles/utils.py @@ -45,3 +45,10 @@ def check_settings(): (settings.MEDIA_ROOT == settings.STATIC_ROOT)): raise ImproperlyConfigured("The MEDIA_ROOT and STATIC_ROOT " "settings must have different values") + for path in settings.STATICFILES_DIRS: + # in case the item contains a prefix + if isinstance(path, (list, tuple)): + path = path[1] + if os.path.abspath(settings.STATIC_ROOT) == os.path.abspath(path): + raise ImproperlyConfigured("The STATICFILES_DIRS setting should " + "not contain the STATIC_ROOT setting")