diff options
| author | Jannis Leidel | 2013-12-10 07:24:30 -0800 |
|---|---|---|
| committer | Jannis Leidel | 2013-12-10 07:24:30 -0800 |
| commit | 7716a53bdd0dd2547056bad901253c1eedfb581a (patch) | |
| tree | 069a7f8e1a2c80a9757d8e504bc45326bbe589a2 | |
| parent | 6e4b255c7225693bc4d8a1fbb7304e6a4b3531e2 (diff) | |
| parent | 3d420c0625e0aa98c8eb224c2d69f6c9694f2d86 (diff) | |
| download | django-debug-toolbar-7716a53bdd0dd2547056bad901253c1eedfb581a.tar.bz2 | |
Merge pull request #495 from aaugustin/require-staticfiles
Be helpful when d.c.staticfiles isn't installed.
| -rw-r--r-- | debug_toolbar/toolbar.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 36c301a..b08efeb 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -6,8 +6,10 @@ from __future__ import absolute_import, unicode_literals import uuid +from django.conf import settings from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured +from django.template import TemplateSyntaxError from django.template.loader import render_to_string from django.utils.datastructures import SortedDict from django.utils.importlib import import_module @@ -57,7 +59,17 @@ class DebugToolbar(object): """ if not self.should_render_panels(): self.store() - return render_to_string('debug_toolbar/base.html', {'toolbar': self}) + try: + context = {'toolbar': self} + return render_to_string('debug_toolbar/base.html', context) + except TemplateSyntaxError: + if 'django.contrib.staticfiles' not in settings.INSTALLED_APPS: + raise ImproperlyConfigured( + "The debug toolbar requires the staticfiles contrib app. " + "Add 'django.contrib.staticfiles' to INSTALLED_APPS and " + "define STATIC_URL in your settings.") + else: + raise # Handle storing toolbars in memory and fetching them later on |
