From 5c1338207127f139fff587512cee991b8335e57e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 14 Nov 2017 15:07:13 -0500 Subject: [PATCH] Closes #1706: Added deprecation warning for Python 2 --- netbox/netbox/settings.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 557b8f067..cba139e56 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -1,6 +1,8 @@ import logging import os import socket +import sys +import warnings from django.contrib.messages import constants as messages from django.core.exceptions import ImproperlyConfigured @@ -12,6 +14,13 @@ except ImportError: "Configuration file is not present. Please define netbox/netbox/configuration.py per the documentation." ) +# Raise a deprecation warning for Python 2.x +if sys.version_info[0] < 3: + warnings.warn( + "Support for Python 2 will be removed in NetBox v2.5. Please consider migration to Python 3 at your earliest " + "opportunity. Guidance is available in the documentation at http://netbox.readthedocs.io/.", + DeprecationWarning + ) VERSION = '2.2.6-dev'