mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
12114 show filename and line number on 500 error page
This commit is contained in:
parent
16e2283d19
commit
816f3e04d2
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
@ -49,10 +50,13 @@ def handler_500(request, template_name=ERROR_500_TEMPLATE_NAME):
|
||||
except TemplateDoesNotExist:
|
||||
return HttpResponseServerError('<h1>Server Error (500)</h1>', content_type='text/html')
|
||||
type_, error, traceback = sys.exc_info()
|
||||
|
||||
fname = os.path.split(traceback.tb_frame.f_code.co_filename)[1]
|
||||
lineno = traceback.tb_lineno
|
||||
return HttpResponseServerError(template.render({
|
||||
'error': error,
|
||||
'exception': str(type_),
|
||||
'fname': fname,
|
||||
'lineno': lineno,
|
||||
'netbox_version': settings.VERSION,
|
||||
'python_version': platform.python_version(),
|
||||
'plugins': get_installed_plugins(),
|
||||
|
@ -29,6 +29,8 @@
|
||||
<pre class="block"><strong>{{ exception }}</strong><br />
|
||||
{{ error }}
|
||||
|
||||
file: {{ fname }} line: {{ lineno }}
|
||||
|
||||
Python version: {{ python_version }}
|
||||
NetBox version: {{ netbox_version }}
|
||||
Plugins: {% for plugin, version in plugins.items %}
|
||||
|
Loading…
Reference in New Issue
Block a user