Django Sample App - Docker & Kubernetes Learning
231
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.
ā
Docker fundamentals with Django
ā
Environment variable configuration
ā
Database flexibility (SQLite ā PostgreSQL)
ā
Kubernetes deployment patterns
ā
Container security best practices
docker run -p 8000:8000 deskpkumar/django-sample-app:latest
# Visit: http://localhost:8000
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
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
| Spec | Value |
|---|---|
| Base | python:3.12-slim |
| Size | ~150MB |
| Port | 8000 |
| User | non-root (appuser) |
| Auto-migrations | ā Yes |
| Static files | ā Pre-collected |
| Variable | Default | Required |
|---|---|---|
SECRET_KEY | insecure-default | Production: Yes |
DEBUG | True | No |
ALLOWED_HOSTS | * | Production: Yes |
DB_ENGINE | sqlite | No |
DB_NAME | django_db | PostgreSQL: Yes |
DB_USER | postgres | PostgreSQL: Yes |
DB_PASSWORD | `` | PostgreSQL: Yes |
DB_HOST | localhost | PostgreSQL: Yes |
DB_PORT | 5432 | No |
| Tag | Description |
|---|---|
latest | Current stable version |
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
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"
Perfect for:
GitHub Repository: kprince28/django-sample-appā
Complete setup guides, troubleshooting, and advanced examples available in the GitHub repo.
ā
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
Content type
Image
Digest
sha256:21b30b1f4ā¦
Size
127.7 MB
Last updated
11 months ago
docker pull deskpkumar/django-sample-app