This is Part 2 of the series "Learn Backend Development by Building a Social Media App.
Welcome back.
In the previous part, you learned what a backend really is and how it quietly powers almost everything inside a modern app. Now it's time to take the first real step: creating your backend project on your own computer.
Before we start typing commands, let's go slowly. I want you to understand what each tool is, why we are installing it, and what your computer is actually doing. Many beginners jump straight into commands without knowing what's happening, and that usually leads to confusion later. We won't do that here. You'll know exactly what's going on.
By the end of this chapter, you'll have a running Django project on your machine. Seeing that browser window open for the first time with your backend responding, that's when the journey becomes real.
Let's begin.
Understanding the Tools We're About to Install
Before we install anything, you should know what role each piece plays.
Python
Python is the language Django runs on. Think of Python as the base ingredient in a recipe. Without it, nothing works.
Django
Django is the framework that helps you create websites and backends quickly. It gives structure, tools, and a lot of built-in features.
Django REST Framework (DRF)
This is the addon for Django. It helps you build APIs so your app (Android, iOS, Web) can talk to your backend easily.
We won't install DRF today. We'll start with Django first so you understand its basics, then add DRF in the next parts.
What Happens When You Install Django?
When you install Django, your computer is basically getting a toolbox filled with:
- tools to talk to databases
- tools to manage users
- tools to build URLs
- tools to create models
- tools to render data
- tools to validate information
- tools to structure your entire project
Django is like a well-organized kitchen. Everything has a piece, everything has a purpose, and nothing is random.
Step 1: Install Python
If you already have Python 3.10 or above, you're good. If not, download it from here.
While installing on Windows, make sure you check the box that says:
Add Python to PATH
Otherwise your computer won't know Python exists.
After installation, you can test by opening the terminal (Command Prompt, PowerShell, or Mac/Linux Terminal) and typing:
python --version
If it prints something like Python 3.10 or Python 3.11, you're ready.
Step 2: Create a Project Folder
Choose a place where you want your backend project to live and create a folder. Name it something simple:
social_media_backend
Then open this folder in VS Code or your preferred editor.
Step 3: Create a Virtual Environment
This is something many beginners don't understand at first, so let's go slow. A virtual environment is like a small, private Python world inside your computer. Only this project will use it. Other projects won't interfere. It keeps your backend clean and avoid dependency problems.
Here's the command to create it:
python -m venv venv
This creates a folder called venv that holds your environment.
To activate it:
On Windows
venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
Once activated, you'll see (venv) appear in your terminal. That means your project is now living in its own safe little world.
Step 4: Install Django
With the virtual environment activate, install Django:
pip install django
Your computer will download Django and set up all its tools. To confirm it installed correctly, type:
django-admin --version
If it shows a version number, everything worked.
Step 5: Create Your Django Project
Now the fun part begins. We're going to create the base structure of your backend.
Inside your project folder, type:
django-admin startproject core .
Let's break this down so you understand:
-
django-adminis the Django command tool -
startprojecttells Django to create a new project -
coreis the name of the project folder Django will create inside your directory - the dot
.means "create it here, not in another folder"
When you run this command, Django generates several files.
Here's how your project now looks:
social_media_backend/
│
├── core/
│ ├── __init.py__
│ ├── settings.py
│ ├── urls.py
│ ├── asgi.py
│ └── wsgi.py
│
└── manage.py
If this looks confusing, don't worry. We're going to understand every part of this folder structure.
Understanding the Django Project Structure
Let's go through the important files slowly:
manage.py
Think of this as your project's remote control. You'll use it to:
- start the server
- apply database migrations
- create apps
- run commands
It's the file you'll run the most.
settings.py
This file controls everything Django does: database settings, installed apps, security, authentication, etc. You'll come back to this file many times as your backend grows.
urls.py
This is where you tell Django, "When someone visits this URL, run this code."
asgi.py and wsgi.py
These connect your project to web servers. We don't need to touch them yet, but they become important when deploying.
Step 6: Run Your Backend for the First Time
Now type:
python manage.py runserver
Your terminal will show something like:
Starting development server at http://127.0.0.1:8000/
Now open your browser and visit:
http://127.0.0.1:8000/
You should see the Django welcome page.
This is a big moment. It means your backend is alive.
Your journey as a backend developer has officially begun.
A Simple Diagram: Your Project Right Now
Here's a visual way to understand what you just created:
Everything you will build later, login, posts, notifications, stories, will start from this simple running server.
What's Next in Part 3
Now that your project is created and running, the next step is understanding users. In Part 3, we'll take our first step towards real backend functionality:
- how databases work
- what models are
- how Django stores data
- how to design a custom user
- how to register a user
It will be your first real interaction with the database.
Till then happy coding!!


Top comments (0)