0

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'

2 Answers 2

1

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.

  1. How to install djongo
pip install djongo

Also, Addi it requirement.txt to capture requirements for next time.

  1. Update database settings as
DATABASES = {
    'default': {
        'ENGINE': 'djongo',
        'NAME': 'your-db-name',
        'CLIENT': {
           'host': 'your-db-host',
        }
    }
}
  1. 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.

Sign up to request clarification or add additional context in comments.

3 Comments

After install python -m pip install pymongo[srv] it works i can runserver.
After applying default migrations i was getting errors in console so i followed below setp. stackoverflow.com/questions/70185942/… Now i am not getting any kind of error and i am able to run django project with MongoDB successfully.
Does it affect the performance compared to in support db like mysql, postgres, oracle?
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.

Why I am getting "Not Implemented Error: Database objects do not implement truth value testing or bool()." while running makemigration cmd in django

Now i am not getting any kind of error and i am able to run django project with MongoDB successfully.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.