Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added an additional check for the availability of the STATIC_* settin…

…gs to make sure upgrading a pre-1.3 project doesn't raise a misleading error. Thanks for the report, Florian Apolloner.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14767 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3d5bb27945e1fc0727309c3656b7727fca3eed28 1 parent a172ed0
Jannis Leidel authored December 02, 2010

Showing 1 changed file with 5 additions and 4 deletions. Show diff stats Hide diff stats

  1. 9  django/contrib/staticfiles/handlers.py
9  django/contrib/staticfiles/handlers.py
@@ -2,6 +2,7 @@
2 2
 from urlparse import urlparse
3 3
 
4 4
 from django.conf import settings
  5
+from django.core.exceptions import ImproperlyConfigured
5 6
 from django.core.handlers.wsgi import WSGIHandler
6 7
 
7 8
 from django.contrib.staticfiles import utils
@@ -25,6 +26,10 @@ def get_base_dir(self):
25 26
         return settings.STATIC_ROOT
26 27
 
27 28
     def get_base_url(self):
  29
+        if not settings.STATIC_URL:
  30
+            raise ImproperlyConfigured("You're using the staticfiles app "
  31
+                "without having set the STATIC_URL setting. Set it to "
  32
+                "URL that handles the files served from STATIC_ROOT.")
28 33
         if settings.DEBUG:
29 34
             utils.check_settings()
30 35
         return settings.STATIC_URL
@@ -42,10 +47,6 @@ def _should_handle(self, path):
42 47
     def file_path(self, url):
43 48
         """
44 49
         Returns the relative path to the media file on disk for the given URL.
45  
-
46  
-        The passed URL is assumed to begin with ``base_url``.  If the
47  
-        resultant file path is outside the media directory, then a ValueError
48  
-        is raised.
49 50
         """
50 51
         relative_url = url[len(self.base_url[2]):]
51 52
         return urllib.url2pathname(relative_url)

0 notes on commit 3d5bb27

Please sign in to comment.
Something went wrong with that request. Please try again.