How to setup debugging of Django app running on remote Docker Compose interpreter with custom entrypoint

Answered

I have a Django app that I run using docker-compose.
I've successfully added the remote docker compose interpreter to the project and I've the autocomplete features working.

I can't get debugging to work properly tough. It hangs on "Waiting for connection..."

I've noticed, that if I remove custom entrypoint script, then it works. I can visit an URL and trigger a breakpoint added in editor.
However, I need this entrypoint to be run, because I wait for database there, migrate data and load fixtures, then start gunicorn to serve the app.

I'm looking for help with the configuration to get the debugger working while having a custom entrypoint. 

0
2 comments

Hi Sylwester!

Your entrypoint should pass the command line from the IDE to the docker-compose service bash as-is. F.e.:

#!/bin/bash
set -e
cmd="$@"

# wait for database, migrate data, load fixtures..

exec $cmd

gunicorn executable is just a Python script so you need to specify it as a Script in the Python Run Configuration.

0

Can you expand on this?  I can't get my entrypoint runs then hangs as if it does not give control back to the dev server.

 

0

Please sign in to leave a comment.