Django-Project#
1. What is django_project here?#
django_project is just a folder I created to organize my work; it is not a Django project. The real Django project is mysite.
django_project is NOT a Django thing.
It is simply a folder I created.
Think of it as a workspace / container / root directory for everything related to this project.
Big picture
There are 3 different levels here:
django_project β My folder (workspace / root)
βββ djenv β Python virtual environment
βββ mysite β Django project (created by Django)
Only mysite is a real Django project.
1οΈβ£ django_project/ (top-level folder)#
- This is:
My personal project folder
Created by me, not Django
Holds everything related to this work
- Purpose:
Keep venv
Keep Django code
Keep future files (docs, notes, scripts)
- You could name it anything:
django_project
django_learning
contents_blog
sherullah_django
Django does not care about this folder name.
2οΈβ£ djenv/ (virtual environment)#
- This folder contains:
Python executable
pip
Django installation
All Python packages
- Why it lives here:
Project isolation
Clean system Python
Easy deletion (rm -rf djenv)
3οΈβ£ mysite/ (actual Django project)#
This is created by:
django-admin startproject mysite
Inside mysite/:
mysite/
βββ manage.py
βββ mysite/
βββ settings.py
βββ urls.py
βββ asgi.py
βββ wsgi.py
THIS is the real Django project.
Important clarification
Name |
What it really is |
|---|---|
django_project |
Not Django, just a folder |
djenv |
Python virtual environment |
mysite |
Django project |
myapp |
Django app |
Simple analogy (real life)
- Think of it like this:
π django_project β Your house
π§° djenv β Your toolbox
π mysite β The building youβre constructing
π§± myapp β Rooms inside the building
Practical: Creating This Django Project#
Now that you understand what each folder means,
letβs create the same structure step by step using real commands.
Before creating a Django project, your system must have Python installed.
- Why Python is required
Django is written in Python
Django runs on top of Python
All Django commands use Python internally
No Python = No Django
Check if Python is already installed
macOS / Linux
python3 --version
Windows
python --version
Expected output:
Python 3.10.x
Django officially supports Python 3.x
Python 2 is not supported
Then place all commands here:
mkdir django_project
cd django_project
python3 -m venv djenv
source djenv/bin/activate
pip install django
django-admin startproject mysite
cd mysite
python manage.py startapp myapp
Install PostgreSQL driver for Django
pip install "psycopg[binary]"