In the last topic, we saw the installation of Django in which we had made a Virtual Environment & installed Django.
So today, we will see how to create a project and applications in Django. Right? Clear?
First of all, what is a Project? Right?
What you have to do is, you have to open your terminal in your project.
If you are on Linux or Windows, you have to open CMD, right?
You have to activate Virtual Background.
First create & then activate.
If any of you don’t know how to activate & how to install Virtual Environment, you can watch our previous video which is about Installation of Django.
So you have to see that video.
Those of you who know how to activate Virtual Environment & how to make a project.
How do you have to make a project?
You have to use this command which I’ve written in Bold -
Django - admin.
Now why is it written Django - admin?
Because it is 1 type of Django’s command so Django - admin startproject.
That also is a command.
And this myproject…
And this myproject is your project’s name, wherein you can name it anything.
Okay? Right? Clear?
I’ll show you how to do it practically.
So what you have to do is, you have to go in your particular folder, where we had created a virtual environment.
Now if you want to activate the Virtual Environment, go to cmd first of all.
Write down your Virtual Environment’s name & activate.
If you don’t activate your Virtual Environment, you won’t get Django’s support.
Because you have installed Django inside the Virtual Environment.
Now what you have to do is, you have to create a Project.
So for creating a Project, you have to write a particular command which is Django - admin startproject and then project’s name.
After you write a project’s name, press space and then you have to enter a full stop.
So that nested folders are not created Okay.
Suppose a folder is created, under that another folder is created, we don’t have to do that.
So it is compulsory to give space & add a dot.
Just as I press Enter, see at the back, a folder named myproject is created and we get a manage . (dot) py that is our Python file.
Let’s first understand how these files work.
So this is a kind of file folder of a project, okay.
Folder file structure, in which your project’s name is myproject.
Under which there is init . py.
Look, I’ll show you here.
In myproject there is init . py.
So what does init . py file do?
See, init . py tells you, It tells your particular folder that this is Python’s folder.
That you have to treat it as Python’s folder.
Then you have settings . py.
See, I’ll show you settings . py.
What settings . py does ? it helps you indicate names, all your project configurations are here as well as all the settings of Projects.
Okay? Right? Clear?
Then comes Urls. py file.
In which…I’ll show you Urls . py file is available here, right.
Now what Urls . py file does is - All links of your project and the function to call.
Which means as you keep making functions, as you keep making views, you have to put them in Urls . (dot) py.
When I’ll show you all of this further in practicals in Django while doing Crud operations & projects. That time I’ll show you this.
Right now, I’m just explaining the file structure & folder structure that how a particular file works and for whom it works.
And then we have a Wsgi . (dot) py file.
I’ll show you the wsgi file here.
What it does is, when you have to deploy a project, when you have to host, it is used that time for your project.
And then comes Manage . py file.
It is on the outer side.
See, it is here, right?
It won’t be in your project, it will be outside only.
What is inside it?
All your commands, such as how to deploy a database, how to scan, how to start your servers, okay, how to migrate your database tables into database, how to make the migrations…
All of that is handled by manage . py.
So you will get all of these files made with the projects you have created.
Okay? Right? Everything clear?
How did we start the project?
First of all, we activated our Virtual Environment and then we wrote a command Django - admin start project, then the project’s name, right, then after pressing space & full stop.
And then you’ll get all the files here in myproject.
And we also got manage . py file.
Now moving forward…
We have to create a Create Application.
So how is an Application created?
For instance, you have already created the project folder.
In that particular cmd, you have to call manage . py & then with the help of that you have to make an application.
What is its command?
Python manage . py startapp and your app’s name.
I have written myapp.
I’ll show you practically.
We have activated this.
Okay, we have made the project.
Now what will we make?
We will make our Application, which is - Python manage . py startapp and then app’s name that is myapp.
As soon as I press Enter, a folder will be created at the back named myapp.
These files have been provided to us here.
So let’s check the file folder structure as in what work the files do and for what they work.
So, for what do these files work?
In myapplication, there is an init . py file.
So what does the init . py do?
It tells you that this particular folder or package works for Python.
Then, you have an admin . py file.
What is admin . py file?
It is used to modify Django Admin Interface, where we register models…
I’ll show you all of this by doing it practically for you to understand clearly.
I’ll just explain to you the folder & file structure of the application.
Then comes Models . py.
What does Models . py do?
It stores the database models of whatever your web application is, it makes it there.
And then comes the test . (dot) py.
What does the test . (dot) do?
It works for Unit Tests.
Unit Test means after your application is made, the testing process does the Unit Tests.
Lastly it is Views . (dot) py, which is the Backend I explained in MVT during the Introduction of Django video, right, I had explained it to you.
Those of you who don't know, I request you to watch that video first & you’ll understand it.
So views . (dot) py is for the application views, meaning it is used to create functions.
Wherein we’ll create our functions and use particular functions there.
Okay? Right? Clear?
And if any of you have any problem or want any file, what you have to do is, you have to go to forums.learnvern.com & define your topic wise queries there and you’ll get your answers
And if you want any particular file, the files will be provided in the description.
If you have any queries or comments, click the discussion button below the video and post there. This way, you will be able to connect to fellow learners and discuss the course. Also, Our Team will try to solve your query.
When we move ahead, our next topic will be how to work with the Django Admin Panel.
I’ll show you in both ways, practically & theoretically, how the predefined Django Admin Panel works.
Okay guys, thank you.
Django is a Python web framework that may be used to create sophisticated online applications.
In Django, an app is a sub-module of a project that implements certain feature.
An app is now a separate Python module that provides functionality to your project.
Within a single Django project, we can develop numerous apps.
In Django, the distinction between a Project and an App is that a Project can be defined as a full application that contains apps that do certain functions. And Apps are components of a project that are self-contained and built to accomplish certain activities.
Django includes six built-in apps that we can look at.
where will i get code access for the project source code?
this course structure is very good. I suggest for learning to this website.
Superb and amazing 😍🤩 enjoyable experience.
Er Komal Gupta
thnku so much sir. after waisting so mch time in boring videos.i learned only from here.explained vry well and i will suggest evryone that learnvern is the bst online plateform where you can learnalot
ajax lesson was something like boring . But , learned a lot with the sunit sir . Just learned how to deal with ajax in django