Connect and Configure MongoDB in Django Project

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys so this video is concerned with the connection of Atlas database with ajango project so let's start first of all let me show you how much project is already written by me so as you can see this is a basic Django project which contains a user profile database where we can take basic information from the user like email password and image and then display it on a web page let me show you the web page yeah so this is theb page where we can display the information taken by the user So currently in this Dango project we are using postra equl database to store data but now we have to change the postr equal database to Atlas database so for that we'll be referring to a Blog by study Gan which have which have given us all the code required to do this task in a very detailed manner let me show you the blog yeah so this is the blog uh okay so let's start first of all let me tell you some prerequisites for the project Django must be installed on a system and you must have a mongod DB database server installed and running all right we'll be using Atlas server uh so first of all let's install jongo uh for this we have to install a particular package of a particular package of job jongo and P so first let's install jongo let me close the server and paste this command Okay so requirement already satisfied uh but you guys can install it on your system uh after this let's configure the database settings.py file um because currently it is configured in a way so that it can be connected to the post G SQL database but now we have to connect it to the Atlas database so I have already written this command so let's copy it and open the settings.py file where we can where we can comment this code and write the new code so let's paste it um here we have to change some details like the name of the database the host username username and password will be same we have to just change the name of the database so let's create a new database um so I have opened atas on my web browser you guys can create a free account so let's go on the database section uh let's wait for it to open okay so here I have already created a cluster named uh named by cluster zero you can you guys can easily create a cluster by clicking on the create option um first of all let's browse Collections and create a new database so let's create a database by the name test d 2 because I have already a database by test DB and the collection name user profile okay let's create it so we have successfully created our database test db2 and inside that we have created a collection user profile so now it's time to connect to our cluster click on the database option again and now let's connect to the cluster um select connect to your application option and now here it is written we have to install Pongo uh but we have to install an older version of Pongo because the new version doesn't work with the jongo which we have installed earlier in this project so I have copied this code and now I have pasted it pip install P 3.2.3 all right so let's install it requirement already satisfied because I have already installed it in my system and after that we can copy this we can copy this address I have already written this address in my code along with my password you guys have to just change this password with your password of the class cluster you will be getting that password while creating the cluster all right so let's jump to the next step now as we have changed the database we have to again make migrations and migrate so first of all let's save the settings file okay [Music] um now let's copy this code and paste it here and migrate so after myig grate we have to create a super user let's wait for this to migrate it can take up to 1 minute so now let's create the super user let's name the super users admin email address we can enter any email address it is not not important password and bypass it so now we have created our super user successfully let's run the server python manage.py run server okay so now let's refresh our site we won't be seeing any data now because all the data is deleted uh and there is no new data in the Atlas so now let's add some data okay so name as user one phone number email address pass one as password and choose an image um let me choose this image okay and now let's save it okay so the user profile has been added successfully let's refresh our page okay so you can see that we have successfully connected our atas database to ajango project so this marks the end of the video thanks for watching
Info
Channel: StudyGyaan
Views: 5,640
Rating: undefined out of 5
Keywords:
Id: iqbw4u4AWUM
Channel Id: undefined
Length: 8min 32sec (512 seconds)
Published: Mon Oct 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.