This content originally appeared on DEV Community and was authored by @rinnah
Day Four of My Django Bootcamp: Crafting the Structure of My Django Project
Today is the fourth day of my Django bootcamp, and it has been an exciting journey so far! I focused on creating and structuring my Django project while learning a lot about apps, templates, and URL configurations. Here’s a friendly walkthrough of how I accomplished it using Git Bash as my terminal.
1. Starting the Django Project 🚀
The first step was to create a new Django project named dijango
. This project would serve as the foundation for everything else. Using Git Bash, I navigated to my desired directory and set up a virtual environment:
mkdir dijango
cd dijango
python -m venv venv
source venv/bin/activate # For Linux/macOS
venv\Scripts\activate # For Windows
Next, I installed Django and created the project:
pip install django
django-admin startproject dijango .
Here’s what the structure looked like at this point:
- manage.py: The project’s control center.
-
dijango/: A directory containing core files like
settings.py
,urls.py
, and others.
2. Creating Applications 🛠️
Django encourages splitting functionality into smaller units called apps. I created two apps, REE1
and REE2
, to separate different functionalities:
python manage.py startapp REE1
python manage.py startapp REE2
Each app came with its own files, like views.py
and models.py
. To make Django recognize these apps, I added them to the INSTALLED_APPS
section in settings.py
:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'REE1',
'REE2',
]
3. Setting Up Templates 🎨
Templates define how the front-end of the app looks. Using Git Bash, I created a templates
directory in the root folder and added subfolders for each app:
mkdir templates
mkdir templates/REE1
mkdir templates/REE2
In settings.py
, I updated the TEMPLATES
configuration to include the new directory:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
4. Configuring URLs 🌐
URL configurations connect specific views to URLs. Since Django doesn’t create urls.py
files for apps by default, I manually added them for REE1
and REE2
.
For REE1/urls.py
:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='ree1_index'),
]
For REE2/urls.py
:
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='ree2_home'),
]
I then updated the main project’s urls.py
to include these app-specific routes:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('ree1/', include('REE1.urls')),
path('ree2/', include('REE2.urls')),
]
5. Adding Views and Templates 🖼️
In Django, views determine what gets displayed for each URL. I created simple views for both apps:
For REE1/views.py
:
from django.shortcuts import render
def index(request):
return render(request, 'REE1/index.html')
For REE2/views.py
:
from django.shortcuts import render
def home(request):
return render(request, 'REE2/home.html')
Next, I added basic HTML templates:
templates/REE1/index.html
:
<!DOCTYPE html>
<html>
<head>
<title>REE1 Index</title>
</head>
<body>
<h1>Welcome to REE1!</h1>
</body>
</html>
templates/REE2/home.html
:
<!DOCTYPE html>
<html>
<head>
<title>REE2 Home</title>
</head>
<body>
<h1>Welcome to REE2!</h1>
</body>
</html>
Using Git Bash throughout this process made it easy to execute commands and navigate between directories. As I continue exploring Django, I look forward to building more complex projects and honing my skills. If you’re on a similar journey, let’s connect and share our progress!
This content originally appeared on DEV Community and was authored by @rinnah

@rinnah | Sciencx (2025-06-30T18:28:29+00:00) Day Four of My Django Bootcamp: Crafting the Structure of My Django Project. Retrieved from https://www.scien.cx/2025/06/30/day-four-of-my-django-bootcamp-crafting-the-structure-of-my-django-project/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.