|
@@ -1,9 +1,6 @@
|
|
|
-from markdown import markdown
|
|
|
+import sys
|
|
|
|
|
|
-from django.conf import settings
|
|
|
-from django.http import Http404
|
|
|
from django.shortcuts import render
|
|
|
-from django.utils.safestring import mark_safe
|
|
|
|
|
|
from circuits.models import Provider, Circuit
|
|
|
from dcim.models import Site, Rack, Device, ConsolePort, PowerPort, InterfaceConnection
|
|
@@ -47,6 +44,14 @@ def home(request):
|
|
|
|
|
|
def trigger_500(request):
|
|
|
"""Hot-wired method of triggering a server error to test reporting."""
|
|
|
-
|
|
|
raise Exception("Congratulations, you've triggered an exception! Go tell all your friends what an exceptional "
|
|
|
"person you are.")
|
|
|
+
|
|
|
+
|
|
|
+def handle_500(request):
|
|
|
+ """Custom server error handler"""
|
|
|
+ type_, error, traceback = sys.exc_info()
|
|
|
+ return render(request, '500.html', {
|
|
|
+ 'exception': str(type_),
|
|
|
+ 'error': error,
|
|
|
+ }, status=500)
|