I am trying to integrate MongoDB and Django. but when i run the code python manage.py runmigrations app_name
i am getting the error:
File "C:\Users\Gourav\Envs\test\lib\site-packages\django\db\utils.py", line 126, in load_backend raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'postgresql', 'sqlite3'
and utils.py
line 119 to 136 code looks like;
builtin_backends = [
name
for _, name, ispkg in pkgutil.iter_modules(django.db.backends.__path__)
if ispkg and name not in {"base", "dummy"}
]
if backend_name not in ["django.db.backends.%s" % b for b in builtin_backends]:
backend_reprs = map(repr, sorted(builtin_backends))
raise ImproperlyConfigured(
"%r isn't an available database backend or couldn't be "
"imported. Check the above exception. To use one of the "
"built-in backends, use 'django.db.backends.XXX', where XXX "
"is one of:\n"
" %s" % (backend_name, ", ".join(backend_reprs))
) from e_user
else:
# If there's some other error, this must be an error in Django
raise
every required directories is already installed in my virtual environment. pip list
gives following result;
asgiref 3.5.2
Django 4.0.5
django-mongoengine 0.5.4
djongo 1.3.6
dnspython 2.2.1
mongoengine 0.24.1
Pillow 9.1.1
pip 22.1.2
psycopg2 2.9.3
pymongo 4.1.1
python-snappy 0.6.1
setuptools 62.1.0
sqlparse 0.2.4
tzdata 2022.1
wheel 0.37.1
winkerberos 0.9.0
Kindly looking for help to solve this error.
The problem is with the new version of pymongo (4.0 from 29.11.2021) which is not supported by Djongo 1.3.6. we need to install pymongo 3.12.1.
follow these steps;
pip uninstall pymongo
pip install pymongo==3.12.3
It will save your time. it took me more than 24 hours to figure it out.