3

I downloaded a code from github and trying to run it as it is by running command in git bash: python manage.py runserver

But I am experiencing this error:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

Have made changes to my manage.py file as suggested in this answer How to use collections.abc from both Python 3.8+ and Python 2.7 but still facing the same error.

import os
import sys

try:
    from collections.abc import Callable
except ImportError:
    from collections import Callable

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
execute_from_command_line(sys.argv)
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
callme_dg
  • 31
  • 1
  • 2

1 Answers1

1

The DeprecationWarning is arising from imports occurring within django itself. This is a known issue in older versions of Django: https://code.djangoproject.com/ticket/30078

It has since been fixed: https://github.com/django/django/commit/aba9763b5117494ca1ef1e420397e3845ad5b262

Based on the release tags for that commit, it appears that the fix first appeared in Django version 2.1.

The solution is to use a newer version of Django.

digartner
  • 11
  • 2