So here’s the deal:
You’ll learn what Django is, how it works, and how to build a working app — all in a way that’s actually readable (and maybe even a little fun).
Perfect if you:
- Know basic Python
- Want to build a web app
- Hate boring tutorials
Let’s get started. You’ll have a Django app running in your browser in 10 minutes or less. 💨
Wait… What Is Django?
Django is a Python web framework that lets you build websites fast — and without all the repetitive setup. It handles the boring stuff (like routing, database access, templates, security) so you can focus on what matters: building.
It’s used by:
- Mozilla
- And a lot of devs who want to ship stuff quickly
Django is your backend butler. It does the dirty work. You build the magic.
How Django Actually Works (Quick Version)
When someone visits your site:
- Django checks the URL
- It runs a matching view function
- That view returns HTML (or data)
- Django sends it back to the browser
It’s like:
User → URL → View → Template → Response → Browser
🛠️ Let’s Build Something: Your First Django App
We're going to:
- Install Django
- Start a project
- Create a view
- Show an HTML page in the browser
Step 1: Install Django
create a folder either in your downloads or documents
then name the folder, for this tutorial we are naming it djangotutorial
In your terminal:
navigate to the folder
cd downloads
then while in the folder, type in
python -m venv venvname
What Does python -m venv venvname Do?
You’re telling Python:
"Hey, create a clean and isolated Python environment in a folder called venvname."
Imagine each Python project you make has its own sandbox — separate from all other projects. That’s what a virtual environment gives you.
Without venv:
- All projects share the same installed packages (like Django, pandas, etc.)
- One project might break if another installs different versions of the same package
then navigate to the venvname folder, type in
cd scripts
while in the scripts folder type in
activate.bat
this will activate the virtual environment
then navigate to the djangotutorial folder
cd../..
then type in
pip install django
Step 2: Create a Project
while in terminal in the same folder:
django-admin startproject myproject
then type in
cd myproject
This creates your project folder. Inside, you’ll see files like settings.py, urls.py, and manage.py.
Step 3: Run the Server
in the terminal type in:
python manage.py runserver
Now open http://127.0.0.1:8000
You’re looking at the Django welcome screen. You’re live!
Step 4: Create an App
Apps are like mini-projects inside your project.
python manage.py startapp djangoapp
then in a code editor open the djangotutorial folder, i am using VS code for the for changes inorder to register the app
Then open myproject/settings.py, find INSTALLED_APPS, and add 'djangoapp', to the list.
INSTALLED_APPS = [
...,
'myapp',
]
Step 5: Write Your First View
Inside djangoapp/views.py:
from django.http import HttpResponse
def home(request):
return HttpResponse("Hello welcome")
Step 6: Set Up URLs
make your way to myproject folder and into urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
]
Now go to myproject/urls.py and connect it:
Now go back to http://127.0.0.1:8000
You’ll see: “Hello welcome”
and if you want help on models, forms, or Django + drop a comment.👇
Top comments (0)