Commits

Diego Búrigo Zacarão committed babc22a

Overriding 500 error handler to include STATIC_URL

Comments (0)

Files changed (2)

transifex/urls.py

 from django.contrib import admin
 import authority
 
+# Overriding 500 error handler
+handler500 = 'views.server_error'
+
 admin.autodiscover()
 authority.autodiscover()
 

transifex/views.py

+from django.conf import settings
+from django.template import Context, loader
+
+def server_error(request, template_name='500.html'):
+    """Always include STATIC_URL into the 500 error"""
+    from django.http import HttpResponseServerError
+    t = loader.get_template(template_name)
+    return HttpResponseServerError(t.render(Context({
+        'STATIC_URL': settings.STATIC_URL})))