Django/Postgre Docker deployment - Localhost:8000 404 error

I am trying to spin up a Django web application and Postgre database using docker-compose. I am following the steps at https://docs.docker.com/samples/django/ pretty spot on, but I am still getting a 404 error on localhost:8000 after spinning up my docker containers. Any help would be appreciated as to why this is not working.

docker-compose.yml:

version: "3.9"

services:
  db:
    image: postgres
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - ./data/db:/var/lib/postgresql/data
  web:
    build: .
    command: bash -c "python3.8 manage.py makemigrations && python3.8 manage.py migrate && python3.8 manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/dittoservice-docker
    ports:
      - "8000:8000"
    environment:
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    depends_on:
      - db

Dockerfile:

FROM python:3.8

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1   

WORKDIR /dittoservice-docker

RUN apt-get update
RUN pip3 install django
RUN pip3 install django-cors-headers
RUN pip3 install djangorestframework
RUN pip install "ditto.py[all]"
RUN pip3 install psycopg2
RUN pip3 install pytz

COPY . /dittoservice-docker

settings.json

    DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.environ.get('POSTGRES_NAME'),
        'USER': os.environ.get('POSTGRES_USER'),
        'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
        'HOST': 'db',
        'PORT': 5432,
    }

Docker-compose up output:

Back to Top