Answers for "django with mongodb"

0

django with mongodb

$ pip install djongo

#In the settings.py
DATABASES = {
        'default': {
            'ENGINE': 'djongo',
            'NAME': 'your-db-name',
            'ENFORCE_SCHEMA': False,
            'CLIENT': {
                'host': 'mongodb+srv://<username>:<password>@<atlas cluster>/<myFirstDatabase>?retryWrites=true&w=majority'
            }  
        }
}
#then create the collections:
$ python manage.py makemigrations <app-name>
$ python manage.py migrate
Posted by: Guest on September-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language