mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 20:07:37 -02:30
show exceptions in plain text, not HTML
This commit is contained in:
1
lib/middleware/__init__.py
Normal file
1
lib/middleware/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
8
lib/middleware/exceptions.py
Normal file
8
lib/middleware/exceptions.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import traceback
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
class ExceptionMiddleware(object):
|
||||||
|
|
||||||
|
def process_exception(self, request, exception):
|
||||||
|
return HttpResponse(traceback.format_exc(exception), content_type="text/plain", status=500)
|
||||||
|
|
||||||
@@ -94,6 +94,7 @@ TEMPLATE_CONTEXT_PROCESSORS += (
|
|||||||
|
|
||||||
MIDDLEWARE_CLASSES += (
|
MIDDLEWARE_CLASSES += (
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'lib.middleware.exceptions.ExceptionMiddleware',
|
||||||
#'django.middleware.transaction.TransactionMiddleware',
|
#'django.middleware.transaction.TransactionMiddleware',
|
||||||
#'devserver.middleware.DevServerMiddleware',
|
#'devserver.middleware.DevServerMiddleware',
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user