diff options
| author | Jacob Kaplan-Moss | 2008-09-15 17:43:10 +0100 | 
|---|---|---|
| committer | Jacob Kaplan-Moss | 2008-09-15 17:43:10 +0100 | 
| commit | a77ee9cee43ec01f43bebc71ad64702fa110b475 (patch) | |
| tree | d222aa163694ddaf3f64571d2e7f6e877c44f121 /debug_toolbar/views.py | |
| parent | 351081586846468c6c8b849e1d4ca5a35d05cd9d (diff) | |
| download | django-debug-toolbar-a77ee9cee43ec01f43bebc71ad64702fa110b475.tar.bz2 | |
Added a mechanism for monkeypatching in debug views, and also added
jquery as both a test case and a place to get started making some js improvements.
I'm not totally thrilled with this approach -- it feels *very* hackish. The alternative might be to simply require installers to add a line to their ROOT_URLCONF, which wouldn't be *bad*, but I like the "load automatically" part of this thing.
Diffstat (limited to 'debug_toolbar/views.py')
| -rw-r--r-- | debug_toolbar/views.py | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/debug_toolbar/views.py b/debug_toolbar/views.py new file mode 100644 index 0000000..40cc7b1 --- /dev/null +++ b/debug_toolbar/views.py @@ -0,0 +1,16 @@ +""" +Helper views for the debug toolbar. These are dynamically installed when the +debug toolbar is displayed, and typically can do Bad Things, so hooking up these +views in any other way is generally not advised. +""" + +import os +import django.views.static +from django.conf import settings + +def debug_media(request, path): +    root = getattr(settings, 'DEBUG_TOOLBAR_MEDIA_ROOT', None) +    if root is None: +        parent = os.path.abspath(os.path.dirname(__file__)) +        root = os.path.join(parent, 'media') +    return django.views.static.serve(request, path, root)
\ No newline at end of file | 
