[Django]-Vscode django debugging error: Couldn't import Django

6👍

I don’t know if you have already solved it, but I give a solution as reference.

The problem is happening because your VS Code is not automatically using your virtualenv as interpreter of the file.
You need to access "Python: Select Interpreter" on your VS Code settings (ctrl+shift+p or clicking on the Python version on the status bar) and change the interpreter to the one located inside your virtualenv. Be sure you select the one that points out to your virtualenv folder ("django-envs" for you. In my case (see picture) it is just "env").

Image displaying the correct virtualenv interpreter

Please also make sure that you have set "Python: Django" in your debug mode, as this is necessary to run and debug correctly your Django app.
And this should allow your debugger to work correctly. 🙂

Leave a comment