Browse files

use links to static files rather than direct inclusion, Fixes #307

  • Loading branch information...
1 parent 119874f commit 189668eadd3f47d8c4a03ad2953b25a3a475a127 @graingert graingert committed Aug 20, 2012
View
0 ...olbar/media/debug_toolbar/css/toolbar.css → ...lbar/static/debug_toolbar/css/toolbar.css
File renamed without changes.
View
0 ...r/media/debug_toolbar/css/toolbar.min.css → .../static/debug_toolbar/css/toolbar.min.css
File renamed without changes.
View
0 ..._toolbar/media/debug_toolbar/img/back.png → ...toolbar/static/debug_toolbar/img/back.png
File renamed without changes
View
0 ...ar/media/debug_toolbar/img/back_hover.png → ...r/static/debug_toolbar/img/back_hover.png
File renamed without changes
View
0 ...toolbar/media/debug_toolbar/img/close.png → ...oolbar/static/debug_toolbar/img/close.png
File renamed without changes
View
0 ...r/media/debug_toolbar/img/close_hover.png → .../static/debug_toolbar/img/close_hover.png
File renamed without changes
View
0 ...media/debug_toolbar/img/djdt_vertical.png → ...tatic/debug_toolbar/img/djdt_vertical.png
File renamed without changes
View
0 ...g_toolbar/media/debug_toolbar/img/dot.gif → ..._toolbar/static/debug_toolbar/img/dot.gif
File renamed without changes
View
0 ...bar/media/debug_toolbar/img/indicator.png → ...ar/static/debug_toolbar/img/indicator.png
File renamed without changes
View
0 ...lbar/media/debug_toolbar/img/panel_bg.png → ...bar/static/debug_toolbar/img/panel_bg.png
File renamed without changes
View
0 ...r/media/debug_toolbar/js/jquery.cookie.js → .../static/debug_toolbar/js/jquery.cookie.js
File renamed without changes.
View
0 ..._toolbar/media/debug_toolbar/js/jquery.js → ...toolbar/static/debug_toolbar/js/jquery.js
File renamed without changes.
View
0 ...toolbar/media/debug_toolbar/js/toolbar.js → ...oolbar/static/debug_toolbar/js/toolbar.js
File renamed without changes.
View
0 ...bar/media/debug_toolbar/js/toolbar.min.js → ...ar/static/debug_toolbar/js/toolbar.min.js
File renamed without changes.
View
4 debug_toolbar/templates/debug_toolbar/base.html
@@ -1,9 +1,9 @@
{% load i18n %}
<style type="text/css">
@media print { #djDebug {display:none;}}
-{{ css }}
</style>
-<script type="text/javascript">{{ js }}</script>
+<link rel="stylesheet" href="{{ STATIC_URL }}debug_toolbar/css/toolbar.min.css" type="text/css">
+<script type="text/javascript" src="{{ STATIC_URL }}debug_toolbar/css/toolbar.min.js"></script>
@nippo
nippo added a note Sep 11, 2012

Hi, there is a typo. in js call, it's not css/, it's js/. And I'm not sure {{ STATIC_URL}} variable will be accessible in every templates.

ah yes, however {{ STATIC_URL}} is available in base, as it's not included with only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
<div id="djDebug" style="display:none;" dir="ltr">
<div style="display:none;" id="djDebugToolbar">
<ul id="djDebugPanelList">
View
2 debug_toolbar/toolbar/loader.py
@@ -60,8 +60,6 @@ def render_toolbar(self):
context = self.template_context.copy()
context.update({
'panels': self.panels,
- 'js': mark_safe(open(os.path.join(media_path, 'js', 'toolbar.min.js'), 'r').read()),
- 'css': mark_safe(open(os.path.join(media_path, 'css', 'toolbar.min.css'), 'r').read()),
})
return render_to_string('debug_toolbar/base.html', context)
View
1 debug_toolbar/urls.py
@@ -9,7 +9,6 @@
_PREFIX = '__debug__'
urlpatterns = patterns('',
- url(r'^%s/m/(.*)$' % _PREFIX, 'debug_toolbar.views.debug_media'),
url(r'^%s/sql_select/$' % _PREFIX, 'debug_toolbar.views.sql_select', name='sql_select'),
url(r'^%s/sql_explain/$' % _PREFIX, 'debug_toolbar.views.sql_explain', name='sql_explain'),
url(r'^%s/sql_profile/$' % _PREFIX, 'debug_toolbar.views.sql_profile', name='sql_profile'),
View
8 debug_toolbar/views.py
@@ -23,14 +23,6 @@ def __str__(self):
return repr(self.value)
-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', 'debug_toolbar')
- return django.views.static.serve(request, path, root)
-
-
def sql_select(request):
"""
Returns the output of the SQL SELECT statement.
View
2 example/settings.py
@@ -17,6 +17,8 @@
INTERNAL_IPS = ('127.0.0.1',)
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
MEDIA_URL = '/media'
+STATIC_ROOT = os.path.join(HOME_ROOT, 'staticfiles')
+STATIC_URL = '/static/'
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
View
0 example/media/js/jquery.js → example/static/js/jquery.js
File renamed without changes.
View
0 example/media/js/mootools.js → example/static/js/mootools.js
File renamed without changes.
View
0 example/media/js/prototype.js → example/static/js/prototype.js
File renamed without changes.
View
2 example/templates/jquery/index.html
@@ -6,7 +6,7 @@
.hide {display:none;}
#v {font-weight:bold;}
</style>
- <script type="text/javascript" charset="utf-8" src="{{ MEDIA_URL }}/js/jquery.js"></script>
+ <script type="text/javascript" charset="utf-8" src="{{ STATIC_URL }}/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('p.hide').show();
View
2 example/templates/mootools/index.html
@@ -5,7 +5,7 @@
<style>
.hide {display:none;}
</style>
- <script type="text/javascript" charset="utf-8" src="{{ MEDIA_URL }}/js/mootools.js"></script>
+ <script type="text/javascript" charset="utf-8" src="{{ STATIC_URL }}/js/mootools.js"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
$$('p.hide').setStyle('display', 'block');
View
2 example/templates/prototype/index.html
@@ -5,7 +5,7 @@
<style>
.hide {display:none;}
</style>
- <script type="text/javascript" charset="utf-8" src="{{ MEDIA_URL }}/js/prototype.js"></script>
+ <script type="text/javascript" charset="utf-8" src="{{ STATIC_URL }}/js/prototype.js"></script>
<script type="text/javascript">
document.observe('dom:loaded', function() {
$('showme').removeClassName('hide');

0 comments on commit 189668e

Please sign in to comment.