title: Django-Compressor throws UncompressableFileError
body: <p>I'm using django-compressor and django-staticfiles (the external version, I'm on Django 1.2).</p>
  
  <p>When I try to load my site, I get an error:</p>
  
  <pre><code>TemplateSyntaxError: Caught UncompressableFileError while rendering: 'css/facebox.css' isn't accesible via COMPRESS_URL ('/static/') and can't be compressed
  </code></pre>
  
  <p>I've verified <code>COMPRESS_URL</code> is equal to <code>STATIC_URL</code>, and the file is actually accessible at that URL.</p>
  
  <p>Looking at the django-compressor code, I found where that exception is thrown:</p>
  
  <pre><code> def get_basename(self, url):
          try:
              base_url = self.storage.base_url
          except AttributeError:
              base_url = settings.COMPRESS_URL
          # I added the following print statement:
          print "url: %s, base_url: %s" % (url, base_url)
          if not url.startswith(base_url):
              raise UncompressableFileError("'%s' isn't accesible via "
                                            "COMPRESS_URL ('%s') and can't be "
                                            "compressed" % (url, base_url))
  </code></pre>
  
  <p>The first <code>{% compress css %}</code> block in my templates is this:</p>
  
  <pre><code>{% compress css %}
  &lt;link rel="stylesheet" href="/static/css/blueprint/screen.css" type="text/css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/facebox.css" /&gt;
  {% endcompress %}
  </code></pre>
  
  <p>(Note that the first link doesn't use <code>{{ STATIC_URL }}</code>, but the second one does)</p>
  
  <p>And I get this in my error log:</p>
  
  <pre><code>[Thu Oct 13 08:19:13 2011] [error] url: /static/css/blueprint/screen.css, base_url: /static/
  [Thu Oct 13 08:19:13 2011] [error] url: /static/css/facebox.css, base_url: /static/
  [Thu Oct 13 08:19:14 2011] [error] url: /static/css/blueprint/screen.css, base_url: /static/
  [Thu Oct 13 08:19:14 2011] [error] url: css/facebox.css, base_url: /static/
  </code></pre>
  
  <p>As you can see, the screen.css file is processed twice, and successful the second time around. The facebox.css file, however, fails the second time, presumable because the <code>{{ STATIC_URL }}</code> isn't defined in the template context the second time the file is parsed.</p>
  
  <p>Obviously I could solve the problem by not using <code>{{ STATIC_URL }}</code>, but that is not an acceptable solution.</p>
  
  <p>Why would my css files be processed twice? They originally had <code>media='screen, projection'</code>, but I removed that thinking it was causing the problem.</p>
  
  <p>Relevant settings:</p>
  
  <pre><code>In [4]: from compressor.conf import settings
  
  In [5]: settings.COMPRESS_ROOT
  Out[5]: '/home/ianchat/static_files'
  
  In [6]: settings.STATIC_ROOT
  Out[6]: '/home/ianchat/static_files'
  
  In [7]: settings.COMPRESS_URL
  Out[7]: '/static/'
  
  In [8]: settings.STATIC_URL
  Out[8]: '/static/'
  
  In [9]: settings.COMPRESS_OUTPUT_DIR
  Out[9]: 'CACHE'
  
  In [10]: settings.COMPRESS_CSS_FILTERS
  Out[10]: ['compressor.filters.csstidy.CSSTidyFilter']
  
  In [11]: settings.STATICFILES_FINDERS
  Out[11]: 
  ('staticfiles.finders.FileSystemFinder',
   'staticfiles.finders.AppDirectoriesFinder',
   'staticfiles.finders.LegacyAppDirectoriesFinder',
   'compressor.finders.CompressorFinder')
  </code></pre>