Django Stat Reloader not working in Dev Container

I have a vs-code dev container in which Django is running. This container is also accessible, but I have two problems: a) The statreloader does not work b) In general, changes are saved within the container, but ignored (even after a restart).

# .devcontainer/devcontainer.json
{
    "name": "Existing Docker Compose (Extend)",

    "dockerComposeFile": [
        "../docker-compose.yml",
        "docker-compose.yml"
    ],

    "service": "django",

    "workspaceFolder": "/workspace",

    "customizations": {
        "vscode": {
            "settings": {},
            "extensions": [
                "ms-python.python",
                "eamodio.gitlens",
                "editorconfig.editorconfig"
            ]
        }
    }
}
# .devcontainer/docker-compose.yml
services:
  django:
    volumes:
      - .:/workspace:cached
# ./docker-compose.yml
name: experiments-graphql
services:
  django:
    image: backend
    build:
      context: ./backend
      dockerfile: ./Dockerfile
    ports:
      - 8000:8000
# ./backend/Dockerfile
FROM python:3.12

EXPOSE 8000

ENV PYTHONDONTWRITEBYTECODE=1

ENV PYTHONUNBUFFERED=1

RUN pip install uv

COPY pyproject.toml uv.lock ./
RUN uv sync && uv lock

WORKDIR /app
COPY . /app

RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

CMD [ "uv", "run", "python", "manage.py", "runserver", "0.0.0.0:8000" ]
Back to Top