초기 환경 구조

1. 전체 구조

. ├── Dockerfile ├── docker-compose.yml └── requirements.txt

2. requirements.txt

Django
psycopg2

3. Dockerfile

FROM python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /web
COPY . .
RUN pip install -r requirements.txt

4. docker-compose

version: "3"

services:
  web:
    build: .
    command: python manage.py runserver 0:8000
    ports:
      - "8000:8000"
    volumes:
      - .:/web
    depends_on:
      - db
  db:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

실행