Introduction to Install Django
Django is an open-source web framework which is based on Python programming language. It is maintained by an independent organization called Django Software Foundation. The primary goal of Django is to provide ease to the complex and data have driven websites. This framework used to focus on reusability and plug-ability of components where less code and low coupling with rapid development is given preference. To install Django, first, you need to install Python in your local machine. So installing python is also covered in this document.
Steps to Install Django
For installing the Django, it needs a stable and good internet connection. Let us discuss the steps required to install Django:
Step 1: First visit the official site of Python which is given below as:
Step 2: After landing to the above web page click on the downloads button shown below as and select your operating system installed in your local system.
In my case, I have clicked on windows.
Step 3: It will redirect to another page where on the very top you will get the title Python Releases for Windows and just below you will get the Latest python release which is shown below as:
Click the very first link which is Latest Python 3 Release-Python 3.7.2. This is the latest version available now for this time you may get the higher version as well but always use the first link.
Note: If a user is using Windows XP or older windows like Vista then click on the second link which is Latest Python 2 Release- Python 2.7.15.
Step 4: After clicking on the above link it redirects to other pages where on the top it shows the latest version of the Python. Just scroll down you would get the title files under which multiple download options are available as shown below:
For Windows 64-bit system, select the first Windows x86-64 web-based Installer marked in red and click on that whereas for 32-bit system select the last red – marked Windows x86 web-based installer.
Step 5: It will take some time to download the file when it gets complete save that installer file. Please click on the installer file but for this, one should have a stable and good internet connection.
Step 6: When you click on the downloaded file it will start a setup launch. The first step is to select the checkbox and click to tick the “Add Python 3.7 to PATH” which shows at very extreme below marked in red. Then click on the Install Now as shown below. If one doesn’t select the Add Python 3.7 to PATH then each time it has to call Python manually and it will take lots of time so please tick the checkbox. You can refer the below-provided image:
Step 7: When one clicks on Install button it will start a warning message “Do you want to make changes in your system” so please click on Yes. It shows for few systems and for few it won’t, it depends upon the system. Then Setup progress as installation will start and looks as below:
Step 8: And when it is done then it shows “Setup was successful” shown below:
Now click on Close button.
Step 9: To check that Python installed successfully or not. Press Windows (Hold this button then) + R (button from keyboard), it will open the Run command. Type “cmd” and press on OK button.
Step 10: It will open the command prompt. Type in the Command Prompt:
If Python is successfully installed, then it shows the version otherwise it shows error. In this case, it shows Python 3.7.2 so Python installed in my system successfully.
Step 11: Then check the current version of pip. Pip is used to install the other packages in the python environment. Please type the following in command prompt:
It will show the installed version of the pip as shown below:
Step 12: Now we’re ready to install the Django because we have set up the environment to install Django. Please use the given URL to open other web pages for Django installation: https://docs.djangoproject.com/en/2.1/howto/windows/
Step 13: When the webpage opens then scroll down a little bit and stop where it shows “Install virtualenv and virtualenvwrapper title” which is shown just above. One needs to use three commands which are marked in red. One needs to install the virtualenv and virtualenvwrapper to provide the virtual dedicated environment for Django. Just below this title, there is code available to install the virtual wrapper. The code is given as:
pip install virtualenvwrapper-win
Step 14: Type Powershell in windows search bar and it gives result Windows Powershell on top then right click on Windows Powershell and click Run as administrator shown as:
Step 15: It will open the power shell and then type the code pip install virtualenvwrapper-win given in the 13th step it will take some time to install the virtual wrapper environment in windows.
Virtual wrapper environment installed successfully.
Step 16: Then create a virtual environment for a Django project. The code is available in URL: https://docs.djangoproject.com/en/2.1/howto/windows/
Type this code or copy the code from the webpage to the Windows Powershell which is given as:
It will create a virtual environment and shown as:
Step 17: Now activate the virtual environment. So copy the code from given URL or from below and type in Windows Powershell.
Now my virtual environment is ready for the installation of the Django.
Step 18: Now finally install the Django using pip command as shown below:
pip install Django
Type the above command in Windows Powershell.
It will take some time for installation but before installation makes sure that your virtual environment is ready which is done in step 17.
Step 19: Now Django is installed successfully. To verify the Django installation, type the following code in Windows Powershell as given below:
If it shows the version of Django, it means Django is installed successfully if not then please check the previous step. Here it shows 2.1.7 which is now the latest Django version.
This has been a guide on how to Install Django. Here we have discussed the concept and different steps to Install Django in our windows. You may also look at the following articles to learn more –