diff --git a/apps/common/templates/500.html b/apps/common/templates/500.html index 2deb3b32bc..950815f80b 100755 --- a/apps/common/templates/500.html +++ b/apps/common/templates/500.html @@ -11,5 +11,10 @@ server problem.

Administrators have been notified, so check back later.

+ {% if request.sentry.id %} +

If you need assistance, you may reference this error as + {{ request.sentry.id }}.

+ {% endif %} + diff --git a/docs/Changelog.txt b/docs/Changelog.txt index afe80c3085..c9368dee76 100644 --- a/docs/Changelog.txt +++ b/docs/Changelog.txt @@ -13,3 +13,4 @@ * Apply default transformations to document before OCR * Added unpaper to the OCR convertion pipe * Added support for concurrent, queued OCR processing using celery +* Added sentry to monitor and store error for later debugging diff --git a/requirements/development.txt b/requirements/development.txt index 4094f10871..7b60a1627b 100755 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -7,4 +7,4 @@ django-rosetta==0.5.6 wsgiref==0.1.2 celery==2.2.2 django-celery==2.2.2 - +django-sentry==1.6.0 diff --git a/requirements/production.txt b/requirements/production.txt index b58d327e2c..86cac17565 100755 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -4,4 +4,4 @@ django-pagination==1.0.7 wsgiref==0.1.2 celery==2.2.2 django-celery==2.2.2 - +django-sentry==1.6.0 diff --git a/settings.py b/settings.py index a47f3a5ea0..6e17899fc9 100755 --- a/settings.py +++ b/settings.py @@ -15,12 +15,10 @@ PROJECT_NAME = 'mayan' DEBUG = False DEVELOPMENT = False -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - # ('Your Name', 'your_email@domain.com'), -) +TEMPLATE_DEBUG = True +ADMINS = () +SENTRY_ADMINS = ('root@localhost',) MANAGERS = ADMINS DATABASES = { @@ -128,6 +126,12 @@ INSTALLED_APPS = ( 'ocr', 'permissions', 'djcelery', + 'indexer', + 'paging', + 'sentry', + 'sentry.client', + 'sentry.client.celery', + ) TEMPLATE_CONTEXT_PROCESSORS = ( diff --git a/urls.py b/urls.py index 3e20856dc6..7b4acac0c6 100755 --- a/urls.py +++ b/urls.py @@ -1,6 +1,8 @@ from django.conf.urls.defaults import * from django.contrib import admin from django.conf import settings +from django.conf.urls.defaults import * +from django.views.defaults import page_not_found, server_error admin.autodiscover() @@ -14,8 +16,24 @@ urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), (r'^admin/', include(admin.site.urls)), (r'^grappelli/', include('grappelli.urls')), + (r'^sentry/', include('sentry.urls')), ) +def handler500(request): + """ + 500 error handler which includes ``request`` in the context. + + Templates: `500.html` + Context: None + """ + from django.template import Context, loader + from django.http import HttpResponseServerError + + t = loader.get_template('500.html') # You need to create a 500.html template. + return HttpResponseServerError(t.render(Context({ + 'request': request, + }))) + if settings.DEVELOPMENT: urlpatterns += patterns('', (r'^%s-site_media/(?P.*)$' % settings.PROJECT_NAME, @@ -27,3 +45,5 @@ if settings.DEVELOPMENT: urlpatterns += patterns('', url(r'^rosetta/', include('rosetta.urls'), name='rosetta'), ) + +