Closes #4991: Add Python and NetBox versions to error page

This commit is contained in:
Jeremy Stretch 2020-08-21 12:58:48 -04:00
parent e02590ac96
commit 802af06c0f
3 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,13 @@
# NetBox v2.9
## v2.9.1 (FUTURE)
### Enhancements
* [#4991](https://github.com/netbox-community/netbox/issues/4991) - Add Python and NetBox versions to error page
---
## v2.9.0 (2020-08-21)
### New Features

View File

@ -31,7 +31,10 @@
The complete exception is provided below:
</p>
<pre><strong>{{ exception }}</strong><br />
{{ error }}</pre>
{{ error }}
Python version: {{ python_version }}
NetBox version: {{ netbox_version }}</pre>
<p>
If further assistance is required, please post to the <a href="https://groups.google.com/forum/#!forum/netbox-discuss">NetBox mailing list</a>.
</p>

View File

@ -1,8 +1,10 @@
import logging
import platform
import re
import sys
from copy import deepcopy
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
@ -1421,6 +1423,8 @@ def server_error(request, template_name=ERROR_500_TEMPLATE_NAME):
type_, error, traceback = sys.exc_info()
return HttpResponseServerError(template.render({
'python_version': platform.python_version(),
'netbox_version': settings.VERSION,
'exception': str(type_),
'error': error,
}))