Browse files

Quick hack for Django 1.3 staticfiles support

Django 1.3 introduces staticfiles which will raise an ImproperlyConfigured
exception if you request a static file when settings.DEBUG is false. This
avoids wasting time serving static media files but it would be nice if we could
find an approach which would still allow us to check file existance.
  • Loading branch information...
1 parent 29b3a2e commit 28f5c8beabe63c5f154c967516dcc5e67d371e51 @acdha acdha committed Mar 28, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 crawler/
@@ -108,7 +108,10 @@ def _parse_urls(self, url, resp):
LOG.log(SUPER_DEBUG, "Skipping external link: %s", link)
- if parsed_href.path.startswith('/'):
+ if ('django.contrib.staticfiles' in settings.INSTALLED_APPS
+ and parsed_href.path.startswith(settings.STATIC_URL)):
+ LOG.debug("Skipping static file %s", parsed_href.path)
+ elif parsed_href.path.startswith('/'):
# We'll use urlparse's urljoin since that handles things like <a href="../foo">

0 comments on commit 28f5c8b

Please sign in to comment.