Updated Django2.28 to Django3.2.24

I’m getting an error when running python3 -Wa manage.py test

Here’s the error that I get and I can’t find any documentation to help solve issue:

(Beekeeper) joshuacovington@Joshuas-MacBook-Pro Beekeeper % python3 -Wa manage.py test
no schedule for compliance.tasks.bigfix.ingest_managed_devices_from_bigfix_regions
no schedule for compliance.tasks.intune.ingest_compliance_checks_from_intune_device_configurations
no schedule for compliance.tasks.intune.ingest_check_results_from_intune_device_configurations_statuses
no schedule for compliance.tasks.intune.ingest_check_results_from_intune_mobile_apps_statuses
no schedule for compliance.tasks.intune.ingest_managed_devices_from_intune_managed_devices
no schedule for compliance.tasks.jamf.ingest_managed_devices_from_jamf_cos
no schedule for compliance.tasks.jamf.ingest_managed_devices_from_jamfsaas
no schedule for compliance.tasks.jamf.unmanage_managed_devices_from_jamfsaas
no schedule for compliance.tasks.escalate.escalate_managed_devices
no schedule for compliance.tasks.escalate.remove_escalation_exemptions
no schedule for compliance.tasks.devices.update_compliance_status_for_managed_devices
no schedule for compliance.tasks.devices.update_inactive_for_managed_devices
no schedule for compliance.tasks.bluepages.update_profiles_from_bluepages
no schedule for compliance.tasks.classification.ingest_classifications_from_bluegroups
no schedule for compliance.tasks.maintanence.clearsessions
/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/utils/version.py:98: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  loose_version = LooseVersion(version)
Traceback (most recent call last):
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/manage.py", line 21, in <module>
    main()
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/apps/registry.py", line 122, in populate
    app_config.ready()
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/contrib/admin/apps.py", line 24, in ready
    self.module.autodiscover()
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/Users/joshuacovington/.local/share/virtualenvs/Beekeeper-p7tw0Pvr/lib/python3.9/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/admin.py", line 32, in <module>
    from compliance.tasks import update_compliance_status_for_managed_devices
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/tasks/__init__.py", line 9, in <module>
    from compliance.tasks.reports import *  # noqa
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/tasks/reports.py", line 4, in <module>
    from compliance.actions.reports import GenerateReportAction
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/actions/reports.py", line 12, in <module>
    import cos
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/cos.py", line 14, in <module>
    logging.config.dictConfig(config)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/logging/config.py", line 809, in dictConfig
    dictConfigClass(config).configure()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/logging/config.py", line 374, in __init__
    self.config = ConvertingDict(config)
TypeError: 'NoneType' object is not iterable

Side note: When posting code, templates, or error messages here, enclose the code (etc) between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code, then another line of ```. (I’ve taken the liberty of modifying your original post for you.)

You might want to break this upgrade down into more incremental steps to see where the problems begin.

You might want to start with upgrading the version of Python to the highest version that Django 2.2.28 works with (3.9), and then upgrade to Django 3.0.14, then to 3.1.14, and then to 3.2 with Python 3.10.

I also suggest you read How to upgrade Django to a newer version | Django documentation | Django

1 Like

Will do my apologies.

Understood. Is it as simple as just changing the version, running the test command and ensuring nothing breaks before trying to migrate changes?

Pretty much. You also want to run it with all warnings enabled to be able to see the deprecation notices.

You also want to start out by doing this first with the current system using the version of Python that it was last known to work with.

I’ve pretty much upgraded django to version 4.1, but now I’m having issues with the crypto.py file. Here’s the error that I’m getting when I try to start up the server

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/core/management/__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/apps/registry.py", line 124, in populate
    app_config.ready()
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/contrib/admin/apps.py", line 27, in ready
    self.module.autodiscover()
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/contrib/admin/__init__.py", line 50, in autodiscover
    autodiscover_modules("admin", register_to=site)
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/django/utils/module_loading.py", line 58, in autodiscover_modules
    import_module("%s.%s" % (app_config.name, module_to_search))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/admin.py", line 33, in <module>
    from compliance.tasks import update_compliance_status_for_managed_devices
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/tasks/__init__.py", line 7, in <module>
    from compliance.tasks.jamf import *  # noqa
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/tasks/jamf.py", line 18, in <module>
    from compliance.mdms.jamf import FORMAT_DATETIME as JAMF_FORMAT_DATETIME
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/compliance/mdms/jamf.py", line 7, in <module>
    import boto3
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import (
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/docs/client.py", line 18, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/utils.py", line 39, in <module>
    import botocore.httpsession
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/botocore/httpsession.py", line 45, in <module>
    from urllib3.contrib.pyopenssl import (
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/OpenSSL/crypto.py", line 1517, in <module>
    class X509StoreFlags(object):
  File "/Users/joshuacovington/Desktop/Git/Beekeeper/beekeeper_env/lib/python3.9/site-packages/OpenSSL/crypto.py", line 1535, in X509StoreFlags
    NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'

I’ve tried referring to the documentation and I’m not seeing any answers regarding this error.
What is the best path forward to resolve or suppress this issue?

Please show the output of a pip list command along with the output of a pip check.

Was just able to figure out the issue. Had a old version of pyOpenSSL that I needed to upgrade. Thank you