Introduction to Installing Django
Hello guys, assalamualaikum, welcome back to another video. In this video, I'm gonna show you how you can install Django with Python 3.11.3 and how to verify the installation of the Django and how to run any project there. Okay?
Downloading the Python Installer
But before you install it, first you need to install the Python with pip in your device. So for install the Python with Pip, first you need to go to the browser and search for Python. And as you can see, you need to visit the first link which is www.python.org. Just click on it, and once you click on it, it will open this kind of web page where you need to go to the download. And as you can see, at the time of making this video, Python 3.11.3 is the latest one. Just download it.
Installing Python and PIP on Windows
And once our download is complete, and as you can see here is the python 3.11.3 exe file. So just double click on it to install it. And once you double click on it, it will open this kind of installation wizard where I need to click on this check box which is going to create a path in our environment variable path. Okay? So make sure that this option is check marked, otherwise it cannot be installed properly.
And after that, for install the PIP, you need to click on the customize installation. And once you click on it, it will show you all of the optional features which is going to install with our Python 3.11.3. And here you also see the pip, which is going to help to download and install the other Python packages. And here you also check mark all of the option and then choose here next. Then it will show you the advance option. Here you need to choose this option, which is going to install the Python 3.11 for all users, okay? And then just simply click on the install.
Verifying the Python and PIP Installation
And as you can see our installation is complete, so just click on the close. So now for verified the installation, you need to go to the search bar and search for CMD. And once our Command Prompt is open, just right here py --version and press enter. And as you can see, it's showing us the Python version which we have installed. Okay?
And also for verified the PIP installation, you need to write here pip --version and press enter. And as you can see, here is the pip version. That means Pip is also installed with our Python 3.11.3, okay?
Creating a Virtual Environment
So now it's time to install the Django. For install it, you need to create a folder. I just name it Django, you can give here whatever you want. And open it and go to the path and remove all the previous path, and simply write here CMD and press enter, and it will open the command prompt in this folder.
So now you need to write here this command, which is going to create a virtual environment in this folder. Just write here python -m venv ...your virtual environment name. I just name it my_virtual_environment and press enter. And as you can see, it's create a virtual environment folder in our this folder which we are create, okay?
Activating the Environment and Installing Django
So now what you need to do, you need to activate the script folder which is inside the virtual environment folder for install the Django. Okay? For activate it, just write here this command. First you write here your virtual environment folder name, then slash, then script, then again slash and write here activate, and press enter. And as you can see, the virtual environment folder name is at the beginning of this command line. That means our script folder is activated. Okay?
So now just write here this command, which is pip install django and press enter. And as you can see, our Django is successfully installed. Okay?
Verifying Django and Creating a New Project
So now for verified the Django installation, you just right here django-admin --version and press enter. And as you can see here is the version of the Django. Okay? And if you want to create a project in your Django, just write here django-admin startproject, then write here your project name. I just name it my_app and press enter. And as you can see here is the Django project which name is my_app. And if you open the folder, you can find here all of the file which is need to be create a Django project, okay?
Running the Django Development Server
And if you want to run this project, you need to go inside the project folder by right here cd space your project folder name and press enter. So now our command line is inside the my_app folder. And now from here, you just write here python manage.py, then space and write here runserver and press enter. And as you can see it will automatically run your project, and here is the project server link. Just copy it and go to your browser and paste it here and press enter. And as you can see, here is the output of this project which we are create.
Conclusion
So I hopefully guys you properly understand how to install the Django with Python 3.11.3 and how to create here any project and how to run it. Okay? If you enjoy this video don't forget to like, comment, and share. And if you like this type of video, don't forget to subscribe to my channel and also press the Bell icon. And I will see you guys in the next one, inshallah. Thank you so much.