Possible to show only traceback in Django error response?

Viewed 112

When an error occurs in Django (specifically an HTTP 500 "Internal Server Error"), I get an error dump that looks like the following, which I've truncated for brevity:

ValueError at <request_url>
invalid literal for int() with base 10: 'jbishop'

Request Method: POST
Request URL: <request_url>
Django Version: 3.0.6
Python Executable: <path_to_python>
Python Version: 3.8.2
Python Path: [ ... several lines of output ...]
Server time: Fri, 15 May 2020 14:11:14 +0000
Installed Applications:
['base.apps.BaseConfig',
 'web.apps.WebConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'qinspect.middleware.QueryInspectMiddleware']


Traceback (most recent call last):
  File "<some_path_here>", line 34, in inner
    response = get_response(request)
  ... continues ...

I never care about all those random variables shown immediately below the first two lines that indicate what error occurred. I always care about the traceback, so I can pinpoint where in my code the problem is occurring.

Does Django provide capability to modify the error response in some way so I can show just the error and the traceback? It drives me crazy that I have to scroll many lines down to get to what's important.

0 Answers
Related