Skip to content

Instantly share code, notes, and snippets.

@Mufaddal1125
Last active March 16, 2024 14:59
Show Gist options
  • Select an option

  • Save Mufaddal1125/8618521bb3ac2c914108b54b3e1481af to your computer and use it in GitHub Desktop.

Select an option

Save Mufaddal1125/8618521bb3ac2c914108b54b3e1481af to your computer and use it in GitHub Desktop.
Django server with postgres and redis
version: "3.8"
services:
web:
command:
["sh", "-c", "python manage.py migrate && python manage.py runserver"]
volumes:
- .:/app
working_dir: /app
ports:
- "8000:8000"
depends_on:
- db
environment:
- DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
- REDIS_URL=redis://redis:6379/0
db:
image: postgres:latest
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
postgres_data:
redis_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment