1. indifex
  2. transifex

Commits

Diego Búrigo Zacarão  committed babc22a

Overriding 500 error handler to include STATIC_URL

  • Participants
  • Parent commits 3917519
  • Branches default

Comments (0)

Files changed (2)

File transifex/urls.py

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

File transifex/views.py

View file
  • Ignore whitespace
+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})))