Debugpy with Docker and Visual Code Ending Automatically

update 4
Even after making several changes to adapt the code to Python version 3.10, used in Alpine container, and Django 4.0, since my code was for Python version 3.8 and Django 3.0.8, the problem remains. It seems to be related to timeout.
Note, error messages no longer appear in the output of the “Debug Console” section.


update 3
I also got it with debupy by adding the line, below, in the wsgi.py file, but the debug auto-terminate issue remains
Code (Python):
debugpy.listen((“0.0.0.0”, 8005))


update 2
I managed to run ptvsd, related to the same project as debugpy, but I still have a problem with the debugger finishing in a short time, a few seconds. Here’s the new snippet in wsgi.py for Gunicorn:
Code (Python):
import ptvsd
ptvsd.enable_attach((‘0.0.0.0’, 8005))


update 1
Using Telnet localhost port, I found that debugpy is only running by Django shell’s interactive mode, but I still haven’t resolved it.


Here are my docker-compose.yaml, Dockerfile, manage.py and launch.json for those who can tell me where the error is, because when I start debugging, VS Code seems to start the debug, but it ends. Below, a link to a file composed of the 4 files mentioned:

Percebi que o problema também acontecia com o debugger “pdb”, então deduzi que o mais provável, ser algo com o Gunicorn, logo, resolvi o problema acrescentando um parâmetro para ele usar um arquivo de configuração como mostrado na imagem abaixo:
image