forked from CGM_Public/pretix_original
Fix raven integration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class PretixBaseConfig(AppConfig):
|
||||
@@ -17,6 +18,10 @@ class PretixBaseConfig(AppConfig):
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if hasattr(settings, 'RAVEN_CONFIG'):
|
||||
from ..sentry import initialize
|
||||
initialize()
|
||||
|
||||
|
||||
default_app_config = 'pretix.base.PretixBaseConfig'
|
||||
try:
|
||||
|
||||
@@ -6,6 +6,15 @@
|
||||
<h1>{% trans "Internal Server Error" %}</h1>
|
||||
<p>{% trans "We had trouble processing your request." %}</p>
|
||||
<p>{% trans "If this problem persists, please contact us." %}</p>
|
||||
{% if request.sentry.id %}
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
If you contact us, please send us the following code:
|
||||
{% endblocktrans %}
|
||||
<br>
|
||||
{{ request.sentry.id }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p>{{ exception }}</p>
|
||||
<p class="links">
|
||||
<a id='goback' href='#'>{% trans "Take a step back" %}</a>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from django.http import HttpResponseForbidden, HttpResponseNotFound
|
||||
from django.http import (
|
||||
HttpResponseForbidden, HttpResponseNotFound, HttpResponseServerError,
|
||||
)
|
||||
from django.middleware.csrf import REASON_NO_CSRF_COOKIE, REASON_NO_REFERER
|
||||
from django.template import TemplateDoesNotExist, loader
|
||||
from django.template.loader import get_template
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.translation import ugettext as _
|
||||
@@ -53,3 +56,14 @@ def page_not_found(request, exception):
|
||||
template = get_template('404.html')
|
||||
body = template.render(context, request)
|
||||
return HttpResponseNotFound(body)
|
||||
|
||||
|
||||
@requires_csrf_token
|
||||
def server_error(request):
|
||||
try:
|
||||
template = loader.get_template('500.html')
|
||||
except TemplateDoesNotExist:
|
||||
return HttpResponseServerError('<h1>Server Error (500)</h1>', content_type='text/html')
|
||||
return HttpResponseServerError(template.render({
|
||||
'request': request
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user