Sign inSign up

deskpkumar/django-sample-app

By deskpkumar

•Updated 11 months ago

Django Sample App - Docker & Kubernetes Learning

Image
Languages & frameworks
Developer tools
Web servers
0

231

deskpkumar/django-sample-app repository overview

⁠Django Sample App šŸ

Perfect for learning Docker & Kubernetes with Django!

A minimal Django application designed specifically for containerization learning. Features flexible database configuration, environment variable management, and production-ready patterns.

ā šŸŽÆ Learning Objectives

āœ… Docker fundamentals with Django
āœ… Environment variable configuration
āœ… Database flexibility (SQLite ↔ PostgreSQL)
āœ… Kubernetes deployment patterns
āœ… Container security best practices

ā šŸš€ Quick Start

⁠Basic Run (SQLite)
docker run -p 8000:8000 deskpkumar/django-sample-app:latest
# Visit: http://localhost:8000
⁠With PostgreSQL
docker run -p 8000:8000 \
  -e DB_ENGINE=postgresql \
  -e DB_NAME=myapp \
  -e DB_USER=postgres \
  -e DB_PASSWORD=mypass \
  -e DB_HOST=postgres-server \
  deskpkumar/django-sample-app:latest
⁠Production-Ready
docker run -p 8000:8000 \
  -e SECRET_KEY="your-secure-key" \
  -e DEBUG=False \
  -e ALLOWED_HOSTS="yourdomain.com" \
  -e DB_ENGINE=postgresql \
  deskpkumar/django-sample-app:latest

ā šŸ“Š Container Details

SpecValue
Basepython:3.12-slim
Size~150MB
Port8000
Usernon-root (appuser)
Auto-migrationsāœ… Yes
Static filesāœ… Pre-collected

ā āš™ļø Environment Variables

VariableDefaultRequired
SECRET_KEYinsecure-defaultProduction: Yes
DEBUGTrueNo
ALLOWED_HOSTS*Production: Yes
DB_ENGINEsqliteNo
DB_NAMEdjango_dbPostgreSQL: Yes
DB_USERpostgresPostgreSQL: Yes
DB_PASSWORD``PostgreSQL: Yes
DB_HOSTlocalhostPostgreSQL: Yes
DB_PORT5432No

ā šŸ·ļø Available Tags

TagDescription
latestCurrent stable version

ā šŸ“š Learning Examples

⁠Docker Compose Stack
version: '3.8'
services:
  django:
    image: deskpkumar/django-sample-app:latest
    ports: ["8000:8000"]
    environment:
      - DB_ENGINE=postgresql
      - DB_HOST=postgres
    depends_on: [postgres]
  
  postgres:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: django_db
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres123
⁠Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: django-learning-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: django-app
  template:
    metadata:
      labels:
        app: django-app
    spec:
      containers:
      - name: django
        image: deskpkumar/django-sample-app:latest
        ports:
        - containerPort: 8000
        env:
        - name: SECRET_KEY
          value: "learning-secret-key"
        - name: DB_ENGINE
          value: "postgresql"

ā šŸ”§ Development & Learning

Perfect for:

  • Docker beginners learning containerization
  • Kubernetes workshops and tutorials
  • CI/CD pipeline experiments
  • Database integration testing
  • Environment configuration practice
  • Container security learning

ā šŸ“– Full Documentation

GitHub Repository: kprince28/django-sample-app⁠

Complete setup guides, troubleshooting, and advanced examples available in the GitHub repo.

ā šŸ›”ļø Security Features

āœ… Non-root user execution
āœ… Environment-based configuration
āœ… Configurable allowed hosts
āœ… No hardcoded secrets
āœ… Minimal attack surface


Created by: Prince Kumar (@kprince28⁠)
Perfect for: Docker & Kubernetes learning with Django
Updated: Latest Django 5.0 + Python 3.12

Tag summary

Content type

Image

Digest

sha256:21b30b1f4…

Size

127.7 MB

Last updated

11 months ago

docker pull deskpkumar/django-sample-app