Closes #1706: Added deprecation warning for Python 2

This commit is contained in:
Jeremy Stretch 2017-11-14 15:07:13 -05:00
parent 3df8c63d5c
commit 5c13382071

View File

@ -1,6 +1,8 @@
import logging import logging
import os import os
import socket import socket
import sys
import warnings
from django.contrib.messages import constants as messages from django.contrib.messages import constants as messages
from django.core.exceptions import ImproperlyConfigured 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." "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' VERSION = '2.2.6-dev'