Debugging Django/Docker environment with VS Code

Im trying to setup VSCode Debugger for a docker/django environment but struggling

im busy following this guide

which worked on a different project, but i can’t seem to find out why it isn’t connecting to my breakpoints in this project. I have opened the ports in docker-compose and everything :/

    build: .
    command: /
      - DJANGO_SETTINGS_MODULE=project.settings_docker
      - ./src:/code
      - 8000:8000
      - 3000:3000
      - mysql

Dockerfile looks something like this

RUN mkdir /code

RUN pip install --upgrade pip
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/base.txt 
    && rm -rf /requirements

ADD ./src /code/

in VS my launch file looks as follows

    "version": "0.2.0",
    "configurations": [
            "name": "Django App",
            "type": "python",
            "request": "attach",
            "pathMappings": [
                    "localRoot": "/Users/{USER}/workspace/{THEAPP}",
                    "remoteRoot": "/code/"
            "port": 3000,
            "host": "localhost"

The that runs the server

python3 migrate --noinput
python3 runserver

If i run this ever now and then i do receive an error message in my console saying.

pydev debugger: unable to find translation for: "/Users/{USER}/workspace/{THEAPP}/src/app/" in ["workspace/{THEAPP}"] (please revise your path mappings).

In the launch.json file for VS i have added the full path to the app, if i use ${workspace} it doesn’t even give the error above.

if i run docker port {docker_container} i get

8000/tcp ->
3000/tcp ->

I also receive the print statement in saying that the debugger has been attached.

i replaced the sensitive information with {} tags for the question

Source: StackOverflow