Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 28f5c8beabe63c5f154c967516dcc5e67d371e51 1 parent 29b3a2e
@acdha acdha authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 crawler/base.py
View
5 crawler/base.py
@@ -108,7 +108,10 @@ def _parse_urls(self, url, resp):
LOG.log(SUPER_DEBUG, "Skipping external link: %s", link)
continue
- 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('/'):
returned_urls.append(link)
else:
# We'll use urlparse's urljoin since that handles things like <a href="../foo">
Please sign in to comment.
Something went wrong with that request. Please try again.