How to combine "Remote debugging with the Python remote debug server configuration" and "Debug multithreaded applications"?

The doc examples are always nice and simple, but real life has these two combined. I am trying to remote debug a django app. I added the debugging code to the script of django, which looks like following:

#!/usr/bin/env python
import os
import sys

import pydevd_pycharm

pydevd_pycharm.settrace('', port=12345, stdoutToServer=True,

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

    from import execute_from_command_line



This connects to the pycharm debugger but stays on the line 


and I don't see any further output. How can I attach the debugger to all the background processes which are getting started, like the daphne server or the channels asgi threads?

1 comment
Which interpreter type do you use? If you use SSH interpreter, there's usually no need to use remote debug serever, as you can debug directly with the SSH interpreter (it describes two ways of debugging).

If you must use remote debug serever -- it's not needed to run settrace() in the You can place settrace() code into views and other code, and the debugger should connect as well.

Please sign in to leave a comment.