← Back to Chapters

Project Structure Overview

? Project Structure Overview

? Quick Overview

Once you create a Django project using the django-admin startproject command, Django generates a standard directory structure for your project. Understanding this structure helps you manage configuration, routing, and deployment efficiently.

? Key Concepts

  • Centralized project configuration
  • Separation of management commands and settings
  • Clear entry points for development and production

? Default Project Structure

? View Code Example
// Default Django project layout
myproject/
manage.py
myproject/
__init__.py
settings.py
urls.py
wsgi.py

? Syntax / Theory

Django follows a predictable structure so developers can quickly locate configuration, routing, and server entry points.

manage.py

? View Code Example
// Common manage.py commands
python manage.py runserver
python manage.py migrate
python manage.py startapp myapp

myproject Directory

  • __init__.py: Marks the folder as a Python package.
  • settings.py: Contains database, apps, middleware, and static file settings.
  • urls.py: Maps URLs to views.
  • wsgi.py: Entry point for production servers.

? Live Output / Explanation

  • Project Directory: Stores core settings and routing.
  • manage.py: Interface for administrative tasks.
  • settings.py: Central configuration hub.
  • urls.py: Controls request routing.
  • wsgi.py: Enables deployment.

? Interactive Understanding

Think of manage.py as the remote control, settings.py as the control panel, and urls.py as the traffic controller directing requests.

?️ Interactive File Explorer

Click on a file to see its "Job Description":

  • ? manage.py
  • ? settings.py
  • ? urls.py
  • ? wsgi.py
Select a file on the left to see details...

?️ Use Cases

  • Running local development servers
  • Managing database migrations
  • Deploying Django apps to production

✅ Tips & Best Practices

  • Organize features into separate Django apps.
  • Review and customize settings.py early.
  • Keep URL patterns clean and readable.

? Try It Yourself

  • Create a new Django project and explore each file.
  • Add a custom route in urls.py.
  • Create an app and register it in settings.py.