(Reading time: 2 - 3 minutes)

Install djongo

 
 
 
pip install djongo
 
 
 

 

Create your project dir

 
 
 
mkdir chillzeeTest
 
 
 

 

Go to your project directory and set up django project.

 
 
 
cd chillzeeTest
 
 
django-admin startproject ChillzeeTestSite
 
 
 

Five Minutes Technology - Using MongoDB with Django framework via Djongo

 

Edit settings.py and update database settings.

 
 
 
DATABASES = {
 
 
    'default': {
 
 
        'ENGINE': 'djongo',
 
 
        'NAME': 'chillzeeproject',
 
 
    }
 
 
}
 
 
 

Five Minutes Technology - Using MongoDB with Django framework via Djongo

 

Run the following command to apply database changes to your django project

 
 
 
python manage.py migrate
 
 
 

 

Visit http://127.0.0.1:8000/ to make sure that your django project is up and running

 

Go to MongoDB and see if the database has been created by django.

 
 
 
show dbs
 
 
 

Five Minutes Technology - Using MongoDB with Django framework via Djongo

 

In our example, django has created the chillzeeproject database.

We will now see the collections to make sure that every thing went fine.

 
 
 
use chillzeeproject
 
 
show collections
 
 
 

Five Minutes Technology - Using MongoDB with Django framework via Djongo

 

Now you can update your models.py file to work on your new mongoDB database, just as you would do with any other database like postgres or mysql.

So that’s it friends! As you could see connecting MongoDB to django has become much simpler now.

Long live open source community!

Oxygen
Author: Oxygen
Other articles by this author


Add comment

Security code
Refresh

Comments  

0 # Five Minutes Technology - Using NoSQL(MongoDB) with django framework via djongo - Step by step tutorial with video and imagesLilly 2019-04-17 09:28
My education budget should be 10-15% of my monthly income.
The article does not likely need being long. There are over 4 billion a person who
have access to the Internet through computers and cell the radio.


Also visit my blog: www joker123
download: http://navigationdrone.com/__media__/js/netsoltrademark.php?d=918kiss.bid%2Fgames%2Fjoker-123
Reply | Reply with quote | Quote

Similar articles

Chillzee Tag Cloud

Let's Socialize

About Chillzee

Chillzee.com is an entrepreneurship portal.

The site provides informative topics on Organizational and Strategic needs.