Debugging local Django app outside server root

Is it possible to debug (e.g. stop on breakpoints) an external Django app when running a Django server in a VM via remote debugging in Pycharm? I am able to run and debug the Django server using PyCharm's remote debugger, and the app runs as expected (changes to the local source code are reflected immediately in the server responses), but I cannot debug the app in the same PyCharm instance running the server.

My directory structure:

django-app/   setup.py   ... (code) django-server/   manage.py   ... (code)

In my requirements file I'm loading the django-app in 'editable' mode:

-e /django-app

I have tried:

  • opening the django-server as the project root and then adding django-app as a new project in the same window, and,
  • opening the shared root directory as the project root and setting django-server/ as the source root & working dir for the server.

In both cases, when I run the server in debug mode, I see the following message if I have any breakpoints set in the django-app:

pydev debugger: warning: trying to add breakpoint to file that does not exist: ... (local path that looks correct)

I would appreciate any ideas as to how to properly step through the django-app component, thanks!
3 comments
Comment actions Permalink
Update:

The django app and the django server are both using the same Python interpreter.

If I try to set a breakpoint in the app, the breakpoint does not exist warning actually is a local file but is in the remote_sources cache:

Connected to pydev debugger (build 135.1057) pydev debugger: warning: trying to add breakpoint to file that does not exist: /Users/.../Library/Caches/PyCharm30/remote_sources/-1170959507/django-app/example.py (will have no effect)
0
Comment actions Permalink

Thank you Byran Blay. I am no longer using this project, so cannot verify, but I appreciate your help.

0

Please sign in to leave a comment.