Project vs App Structure

🐍 DjangoLesson 2Beginner

In Django, a **Project** represents the entire web application and its configuration. An **App** is a self-contained module that does one specific job (e.g., a blog app, comments app, or checkout app). A project can contain multiple apps.

1 File Layout and Structure
Shell — Standard Project Layout
myproject/                     # Project Root
  manage.py                    # Command-line utility
  myproject/                   # Configuration Directory
    __init__.py
    settings.py                # Main project settings
    urls.py                    # Root URL routing
    wsgi.py & asgi.py          # Deployment entry points
  blog/                        # A Django App
    migrations/                # DB history files
    __init__.py
    admin.py                   # Register models here
    apps.py                    # App configuration
    models.py                  # Database schemas
    tests.py                   # App-specific tests
    views.py                   # View handlers
    urls.py                    # App-specific routing
2 Basic Management Commands
Shell — Terminal Commands
# Create a new project
django-admin startproject myproject

# Create a new app inside the project
python manage.py startapp blog

# Run the local development server
python manage.py runserver

# Apply migrations
python manage.py migrate
3 Code Challenge
Challenge: Set up a new virtual environment, install Django, run startproject config ., create a new app named accounts, and register it inside the INSTALLED_APPS array in settings.py.