How to install django on windows: step-by-step guide

nitish96
Nitish Sharma
Published on: November 22, 2024
Updated on: November 24, 2024
How to install django on windows: step-by-step guide blog

Install Python

Django requires Python to run. Follow these steps to install Python on your Windows system:

Download Python

  • Visit the official Python website  and download the lastest version of Python for Windows.
  • Choose the appropriate installer for your system

Install Python

  • Run the downloaded installer.
  • Select "Add Python to PATH" before clicking the Install button.
  • Choose "Customize Installation" to ensure pip (Python package manager) is selected for installation.

Verify Installtion

Open Command Prompt and type:

python --version
pip --version

Install a Virtual Environment

A virtual environment ensures project dependencies are isolated.

  1. Install virtualenv

pip install virtualenv

    2. Create a Virtual Environment

Navigate to the folder where you want to create your Django project and run:

python -m virtualenv venv

Replace venv with your desired environment name.'

 3. Activate the Virtual Environment

Use the following command to activate it:

venv\Scripts\activate

Install Django

Install django by giving following command

pip install django

Django Setup

Once Django is installed, we can start to create a new Django project.

Start a new Django Project

Start a project by following command-

django-admin startproject django_project

Navigate to the Project Directory

Change directory to django_project

django-admin startproject django_project
cd django_project

Start the server

Start the server by typing following command in cmd:

python manage.py runserver
(env) PS E:\startanpm-blog\django_project> python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
November 17, 2024 - 20:52:27
Django version 5.1.1, using settings 'django_project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

Conclusion

You now have Django installed on your Windows system and are ready to start building we applications.

Comments

Login to leave a comment.

Build Software Application with Impact Hive