How can I use VS Code breakpoints to debug Open edX running in Tutor containers?

Hi all,

I’m running Open edX (Sumac) locally with Tutor, and I’d like to use VS Code’s inbuilt debugger with breakpoints. The challenge is that Tutor runs services (LMS, CMS, workers, etc.) inside Docker containers, so VS Code can’t directly attach like it would with a local Django project.

I know that I can use

import pdb; pdb.set_trace()

and then attach to the container — I’ve been doing that for quite some time already. But if I could use VS Code’s built-in debugger with proper breakpoints, that would be much nicer and more productive.

So my questions are:

  1. What’s the recommended way to install a Python debugger like debugpy inside the Tutor dev containers (LMS, CMS, workers)?

  2. How can I expose the debugger port (e.g., 5678) from the container to the host so VS Code can attach?

  3. How should I configure path mappings so that breakpoints in my local edx-platform folder match the code running inside the container?

If anyone has a working launch.json setup or a Tutor plugin/override they use for this workflow, I’d really appreciate an example.

Thanks!

Hi @Yogesh . Here is a solution that has been shared to do this. I’ve taken that solution and adapted things to work with the Dev Containers extension. In this scenario, VS Code can attach from within the container, so you don’t need to expose the debugger port. I’m planning on posting a write-up on it here in the forums soon and I’ll share the link when that is up.

1 Like

Here is my writeup on it:

1 Like

Thanks a lot @tpayne

This looks really useful — I’ve been relying on pdb.set_trace() inside the container until now, but being able to use VS Code’s debugger directly with Dev Containers sounds much smoother. I’ll give your write-up a try and see how it works with my Tutor (Sumac) dev setup.

Really appreciate you sharing this here — it’s exactly the kind of workflow I was hoping for!