"Embarking on Django: Your First Steps to Web Development Mastery"

🕸️ Hello Beautiful People!
Come with me to learn Django in the easiest way possible!
🌟 What is Django?
Django is a high-level Python web framework that helps you build dynamic websites quickly and with clean, readable code.
💡 What does "high-level" mean?
When a technology automates many small, repetitive tasks for you — like connecting to a database, handling user sessions, or managing templates — it allows developers to focus on more important project logic.
Examples: Python and Django are both high-level because they do a lot of the heavy lifting.
Django is also free, open-source, and follows the Model-View-Template (MVT) architecture.
🛠️ Tools You Need
To follow along with this tutorial, make sure you have:
✅ Python – A programming language (Download from python.org)
✅ Git – Version control to track your project changes (Install Git)
✅ VS Code – A beginner-friendly code editor (Download VS Code)
✅ Step 1: Set Up Your Project Folder
Create a new folder anywhere on your computer.
You can name it something likeDjangoPractice
orMyProjects
.Open VS Code.
Go to
File → Open Folder
, and select your folder.
This is where all your Django work will live!
🧪 Understanding Virtual Environments
Before jumping in, let’s learn why virtual environments are important.
Imagine you have different Django projects that need different versions of Python or Django. If you install everything globally (on your whole computer), things can break.
🧠 A virtual environment is like a private room for each project where you can install packages without messing up your system.
🧰 Step 2: Create and Activate a Virtual Environment
In your VS Code terminal, type:
python -m venv env
This tells Python:
“Hey, create a virtual environment named
env
for me!”
Once it’s created, activate it:
.\env\Scripts\activate
You’ll notice your terminal changes slightly (you’ll see (env)
in front of the line). That means your virtual environment is now active! 🎉
❗ Note: If your antivirus blocks this step or you're facing issues, it's okay to skip virtual environments just for now as a beginner.
📦 Step 3: Install Django
Now that your virtual environment is active, it’s time to install Django.
Run this command:
pip install django
What this means:
You’re telling pip
(Python’s package manager) to install Django inside your virtual environment
To check whether Django installed or not:
Django-admin --version
🎉 You’ll see the Django version printed!
🚀 Step 4: Start Your Django Project
Still in your terminal, navigate to your folder if you aren’t already:
cd yourfoldername
Now create your first Django project:
django-admin startproject mysite
Your project folder is now created!
🧠 Understanding the Project Structure
Here’s what’s inside:
manage.py – The command center for running Django tasks (like starting the server or making migrations).
mysite/ – The actual project settings and configurations.
init.py – Tells Python this is a package.
settings.py – Contains all your project settings.
urls.py – Controls the routing/URLs of your site.
asgi.py / wsgi.py – These connect your app to servers (don't worry about them for now).
🗂️ Step 5: Initialize Git (Optional but Recommended)
If you want to track changes using Git (recommended),
git init
This creates a Git repository in your project so you can track changes over time.
🧩 Step 6: Create Your First App
In Django, a project is the overall website, and an app is a specific feature or module — like a blog, contact form, or user login.
To create your first app, use:
python manage.py startapp myapp
This command calls the manage.py
file to create an app called myapp
.
📁 Inside Your App Folder
You'll find these files:
admin.py – Lets you customize how your app appears in the Django admin panel.
apps.py – Settings specific to the app.
models.py – Where you define your database schema using Python classes.
views.py – Where your app’s logic and response functions live.
tests.py – For writing automated tests.
migrations/ – Keeps track of database changes.
init.py – Marks the folder as a Python package.
⚙️ Step 7: Register Your App
Go to mysite/settings.py
.
Find the INSTALLED_APPS
list and add your app name like this:
pythonCopyEditINSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
...
'myapp', # 👈 Your app name here
]
This tells Django to include your new app in the project.
🎉 Congratulations!
You’ve now:
✅ Set up Python and Django
✅ Created a virtual environment
✅ Started your Django project
✅ Built your first app
You’re officially on your way to becoming a Django Developer! 🚀
👋 Let’s Meet Tomorrow for Part 2
Tomorrow, we’ll:
Run your Django development server
Create your first view
Map URLs
See your first webpage in action!
Until then — keep exploring and experimenting!
Subscribe to my newsletter
Read articles from Lekha Sri directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
