How to use Django with MongoDB by adding just one line of code ?🔥✅

 To use MongoDB as your database in your #django project,  follow below steps

Django-Mongodb


Step 1: Download Package Djongo to download package open command prompt and type this command  pip install djongo

Step 2: Download MongoDB ComPass Version from this link https://www.mongodb.com/try/download/compass after downloading install MongoDB compass version and open compass version window and you will get connect database button click on this button 

Step 3: Create Django Project by typing command in CMD like django-admin startproject <projectname>

Step 4: After creating project open settings.py file and just add this one line into your settings.py file:

DATABASES = {

    'default': {

        'ENGINE': 'djongo',

        'NAME': 'todoapp',

    }

}


Post a Comment

0 Comments