django feature image

What is Django?

Django is an open source web framework which allows users to build web applications with the help of python scripting language. It follows the model-view-template (MVT) architectural pattern to accomplish tasks.

Django is maintained by an independent non-profit organization named as Django Software Foundation (DSF). Django’s main focus is to create dynamic robust database-driven websites. The great feature of Django is that its reusability of components simply means that ” don’t repeat yourself “.

How to install Django on Windows 10 PC?

To install Django we need python to be installed in our Machine. But python is updated frequently. So, It might happen when we developing our applications python get updated and it sometimes causes problems. Because Newer version python may not support previous python’s feature. So, it is always good practice when we developing with Django we install python in Virtual Environment.

You think that it will be complicated to install Django and python in Virtual Environment.But Annaconda website helps us to do that very easily. We just simply write a Command in Windows PowerShell Django as well as python will get installed in Virtual Environment. Before you start make sure that you have internet access.So, Let’s Do that.

First, you need to install Annaconda. If you have already installed Annaconda.Then Skip this section and jump to the command line section.

For, 64-bit operating system.

download 64-bit.

For, 32-bit operating system.

download 32-bit.

When the download is finished.Open the exe file.

You will see like this:

Django install screen

You have to click next button as you see in the screenshot.

Django intall screen

Then, you have to click I Agree button.You will see.

Django install screen

If you want to install Annaconda for your all user.Then click All users radio button.Then, click next.You will see.

Django install screen

Here you have to select your install directory.and click next.

Django install screen

and click Install to install Annaconda. Here you set Annaconda as Environment Variable.

You will see like above screenshot if you successfully install Annaconda on your Machine and click next.

you can install Visual studio code on your machine or you click Skip and finish your installation.

Now to install Django.You have to follow below step:

command line section:

From windows search Box we find Windows PowerShell open it.

windows powershell

Then we just simply write below command in your PowerShell and press Enter:

conda create --name myvirtualEnv django

In the above command, bolded portion is actually virtual environment name.you can give your virtual environment name as you want.

Now, you will see like this:

django command

In the above, screenshot I underlined (red color) some text. First, I  underlined the command we give to the PowerShell. Next, I underlined the Version of Django and python. Make sure that your Django version is at least 1.10. Then In the last line, we see proceed option. You press “y” to install or “n” to exit. To install Django you have to press “y“.

It will take some time to install be patient at that time.

So, then you will see like below screenshot :

ending command

If you see this in your PowerShell, then congratulation you successfully install Django and python virtual environment on your machine.

In the above screenshot, you see that you have to write “activate myvirtualEnv” to activate your virtual environment and to deactivate simply write”deactivate myvirtualEnv”.

Till now we just create our virtual environment. So, now we have to make Django web application and to test Django web application actually work or not.

To do that you have to first open your Command Prompt from Run then you have to activate the virtual environment. After we activate the virtual environment we have to specify the path where we want to put our Django web application.

run command activate Django

In the above screenshot first, we activate the virtual environment then we specify the path(with cd Command) where I want to put the Django web application.

Then we write the below command to create Django project:

django-admin startproject django_project

In the above Command, you can name your project(bolded) whatever you want.

When you run the above command you will see a project folder in the following directory where you want to put your project.

django [roject

If you see the project folder Congratulation you create your project.Now I run the web application to test it works or not.

To do that you have to go into your project folder. With simply writing command 

cd django_project

Then you have to write command:

python manage.py runserver

you will see like this:

run server

If you see like this, then Congratulation you successfully run your Django web application.

To actually visualize with your browser you have to write the following URL in your browser:

http://127.0.0.1:8000/

and you will see:

browser

If you view this page this means you successfully install Django on your machine.

Thanks for reading.I hope you find this article helpful. For any Information and Suggestion feel free to comment.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.