raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: 'django' 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'
Asked
Active
Viewed 495 times
2 Answers
0
The best way to use MongoDB with Django is by using DJONGO
package. It is a kind of django package developed only for the purpose to make Django compatible with MongoDB.
- How to install
djongo
pip install djongo
Also, Addi it requirement.txt
to capture requirements for next time.
- Update database settings as
DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'your-db-name',
'CLIENT': {
'host': 'your-db-host',
}
}
}
- Run migrations
python manage.py makemigrations <app_name>
and then run migrate changes to DB
python manage.py migrate
djongo
is compatible with Python >=3.6
and MongoDB>=3.4
.

Umar Hayat
- 4,300
- 1
- 12
- 27
-
After install python -m pip install pymongo[srv] it works i can runserver. – Praveen Chouhan Aug 06 '22 at 08:40
-
1After applying default migrations i was getting errors in console so i followed below setp. https://stackoverflow.com/questions/70185942/why-i-am-getting-not-implemented-error-database-objects-do-not-implement-truth Now i am not getting any kind of error and i am able to run django project with MongoDB successfully. – Praveen Chouhan Aug 06 '22 at 10:20
0
After followed above steps i install python -m pip install pymongo[srv] it works i can run django project.
After applying default migrations i was getting errors in console so i followed below step.
Now i am not getting any kind of error and i am able to run django project with MongoDB successfully.

Praveen Chouhan
- 3
- 3