Permalink
Browse files

Partial resolution for #44.

Still more work needed here, to make it work with both django <=1.2 and >=1.3, where non-DEBUG
installations reject static serving of files. There is a new contrib.staticfiles app, but
only one method will work at a time.
  • Loading branch information...
1 parent 2fe5cc1 commit 6d19a68d810fce0badb09cff59028733a0e90a0d @schinckel committed Dec 8, 2010
Showing with 19 additions and 14 deletions.
  1. +7 −0 docs/install.rst
  2. +6 −6 sentry/templates/sentry/index.html
  3. +0 −3 sentry/urls.py
  4. +6 −5 sentry/views.py
View
@@ -25,6 +25,13 @@ Once installed, update your settings.py and add ``sentry``, ``sentry.client``, `
...
)
+To enable Sentry to find it's media under django 1.3+ and its static media handling, you'll need to add in the following to your settings:
+
+ import sentry
+ STATICFILES_DIRS = (
+ ('sentry', path(sentry.__file__).dirname() / 'media'),
+ )
+
You will also need to add ``sentry.urls`` to your url patterns::
urlpatterns = patterns('',
@@ -7,23 +7,23 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="robots" content="NONE,NOARCHIVE">
<link href='http{% if request.is_secure %}s{% endif %}://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:light,regular&amp;subset=latin' rel='stylesheet' type='text/css'>
- <link rel="shortcut icon" href="{% url sentry-media "images/sentry.png" %}"/>
+ <link rel="shortcut icon" href="{{ STATIC_URL }}sentry/images/sentry.png"/>
<title>{% block title %}Sentry{% endblock %}</title>
<script type="text/javascript">
SENTRY_JS_API_URL = '{% url sentry-ajax %}';
</script>
<script type="text/javascript" src="http{% if request.is_secure %}s{% endif %}://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
- <script type="text/javascript" src="{% url sentry-media "scripts/highcharts.js" %}" ></script>
- <script type="text/javascript" src="{% url sentry-media "scripts/jquery.animate-colors-min.js" %}"></script>
- <script type="text/javascript" src="{% url sentry-media "scripts/global.js" %}"></script>
- <style type="text/css">@import '{% url sentry-media "styles/global.css" %}';</style>
+ <script type="text/javascript" src="{{ STATIC_URL }}sentry/scripts/highcharts.js"></script>
+ <script type="text/javascript" src="{{ STATIC_URL }}sentry/scripts/jquery.animate-colors-min.js"></script>
+ <script type="text/javascript" src="{{ STATIC_URL }}sentry/scripts/global.js"></script>
+ <style type="text/css">@import '{{ STATIC_URL }}sentry/styles/global.css';</style>
</head>
<body>
{% block body %}
<div id="header">
<div class="container">
- <h1><a href="{% url sentry %}"><img src="{% url sentry-media "images/sentry.png" %}" border="0" width="32"/>Sentry</a></h1>
+ <h1><a href="{% url sentry %}"><img src="{{ STATIC_URL }}sentry/images/sentry.png" border="0" width="32"/>Sentry</a></h1>
<h2>{% block heading %}Dashboard{% endblock %}</h2>
<ul class="nav" id="account">
{% if request.user.is_authenticated %}
View
@@ -10,9 +10,6 @@
SENTRY_ROOT = os.path.dirname(__file__)
urlpatterns = patterns('',
- url(r'^_media/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': os.path.join(SENTRY_ROOT, 'media')}, name='sentry-media'),
-
# Feeds
url(r'^feeds/%s/messages.xml$' % re.escape(KEY), MessageFeed(), name='sentry-feed-messages'),
View
@@ -12,6 +12,7 @@
from django.http import HttpResponse, HttpResponseBadRequest, \
HttpResponseForbidden, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response, get_object_or_404
+from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils import simplejson
from django.utils.safestring import mark_safe
@@ -55,7 +56,7 @@ def login(request):
context = locals()
context.update(csrf(request))
- return render_to_response('sentry/login.html', locals())
+ return render_to_response('sentry/login.html', locals(), context_instance=RequestContext(request))
def logout(request):
from django.contrib.auth import logout
@@ -103,7 +104,7 @@ def index(request):
has_realtime = page == 1
- return render_to_response('sentry/index.html', locals())
+ return render_to_response('sentry/index.html', locals(), context_instance=RequestContext(request))
@login_required
def ajax_handler(request):
@@ -204,7 +205,7 @@ def iter_data(obj):
page = 'details'
- return render_to_response('sentry/group/details.html', locals())
+ return render_to_response('sentry/group/details.html', locals(), context_instance=RequestContext(request))
@login_required
def group_message_list(request, group_id):
@@ -214,7 +215,7 @@ def group_message_list(request, group_id):
page = 'messages'
- return render_to_response('sentry/group/message_list.html', locals())
+ return render_to_response('sentry/group/message_list.html', locals(), context_instance=RequestContext(request))
@login_required
def group_message_details(request, group_id, message_id):
@@ -246,7 +247,7 @@ def iter_data(obj):
page = 'messages'
- return render_to_response('sentry/group/message.html', locals())
+ return render_to_response('sentry/group/message.html', locals(), context_instance=RequestContext(request))
@csrf_exempt
def store(request):

0 comments on commit 6d19a68

Please sign in to comment.