Django Installation


Django Setup Guide

Step 1: Confirm Python is Available

Confirm Python is installed by running a version check in your terminal.

python --version

or (for some systems):

python3 --version

If it shows a version (e.g., 3.11.0), you're good. If not, visit https://www.python.org and install the latest one suitable for your platform.

Step 2: Create a Virtual Environment

Before starting Django, it’s better to isolate your project’s packages.

Use this line:

python -m venv env

Then activate the virtual environment:

Windows:

env\Scripts\activate

macOS/Linux:

source env/bin/activate

Once activated, your terminal will show (env) at the beginning.

Step 3: Get Django Installed

Now, bring in Django through pip:

pip install django

This fetches the most recent Django release within your virtual setup.

To verify Django was added:

django-admin --version

Step 4: Launch a New Django Project

Time to start your first web project. Use this command:

django-admin startproject mysite

This generates a folder named mysite with essential files and folders already arranged.

Move into it:

cd mysite

Step 5: Try Running the Local Server

Spin up the development server:

python manage.py runserver

You'll see an address like:

Starting development server at http://127.0.0.1:8000/

Open it in your browser. If a welcome screen appears, Django is ready!


Useful Commands

Create an app:

python manage.py startapp blog

Apply database migrations:

python manage.py migrate

Make an admin user:

python manage.py createsuperuser

Prefer Learning by Watching?

Watch these YouTube tutorials to understand HTML Tutorial visually:

What You'll Learn:
  • 📌 How To Install Django For Python 3.11.3 | PIP and Django on Windows 10/11 | Django Tutorials
  • 📌 #2 Django tutorials | Setup
Previous Next