Creating a Project Structure for Wagtail + Django
November 29, 2025 Β· 3 min read
Overview of the backend layout and best practices.

hhhhh
jjjjjj
π§± Backend Project Structure
This document provides an overview of the backend directory structure for the Django + Wagtail project.
π Project Layout
backend/
β
βββ Dockerfile # Docker build instructions for production/deployment
βββ manage.py # Django CLI: runserver, migrate, createsuperuser, etc.
βββ home/ # Main Wagtail page app
β βββ __init__.py # Marks module as a Python package
β βββ apps.py # Django AppConfig for "home"
β βββ models.py # Wagtail Page models (HomePage, blocks, etc.)
β βββ templates/ # Templates owned by this app
β β βββ home_page.html # Template for HomePage (if not fully headless)
β βββ static/ # App-specific static assets
β β βββ css/ # CSS files for the home app
β βββ migrations/ # Database schema history for this app
β β βββ 0001_initial.py # Initial migration generated by Wagtail scaffold
β β βββ 0002_create_homepage.py # Migration generated by for homepage creation
β βββ tests.py # Unit tests for the home app
βββ search/ # Simple search app (no models)
β βββ __init__.py # Marks module as a Python package
β βββ views.py # Search view using Wagtail search backend
β βββ templates/ # Templates for search results
β βββ results.html # Template that displays search results
β # NOTE: no migrations because search has no models
β # NOTE: no apps.py β Django uses default AppConfig
β # NOTE: no static/ β search app contains no assets
β
βββ mysite/ # Core Django project configuration
β βββ __init__.py # Marks project module as a Python package
β βββ settings/ # Modular Django + Wagtail settings
β β βββ __init__.py # Makes settings importable
β β βββ base.py # Shared settings for all environments
β β βββ dev.py # DEBUG, local DB, dev middleware, etc.
β β βββ production.py # Security, caching, production toggles
β βββ urls.py # Root URL routing (wagtail admin, API, home routes)
β βββ wsgi.py # WSGI entrypoint for Gunicorn/apache
β βββ asgi.py # ASGI entrypoint for Uvicorn/Daphne (async support)
β βββ static/ # Project-wide static files (logos, overrides, etc.)
β βββ templates/ # Global templates (layout, shared UI)
β βββ base.html # Main template inherited by others (if not headless)
βββ requirements.txt # Python dependencies for pip instalL
βββ venv/ # Optional: local virtual environment
π Overview
This structure follows typical Django best practices, including:
- Each app (e.g.,
home/,search/) is isolated with its own templates and migrations. - The
mysite/folder contains global project config (settings, URLs, WSGI/ASGI). Dockerfilemakes the backend ready for containerized deployments.- A dedicated
static/andtemplates/folder is included for project-wide frontβend assets.
π Requirements
Install dependencies:
pip install -r requirements.txt
βΆοΈ Running the Project
Start the development server:
python manage.py runserver
π§ͺ Running Tests
python manage.py test