pycharm remote docker debug with external sources

 

Great IDE pycharm can easy debug with docker-compose.yml file. But default guid not metioned how to config debug with external sources. If Problem happend in external sources ,I have to stupid add sources to my project for debug. After Google a lot ,it seems like path mapping problem. What important is the breakpoint you locate can not be in pycharm cache, you can check this when move cursor to the source tab shows the path.

Solution(Menu:Pycharm>Project Interpreter):

  1. Click dots in the end of “Path mappings”
  2. find your local python path ,if you using py3 in mac the path should looks like “/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4”
  3. Add two mappings ,below is my config

“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-package” : “/usr/local/lib/python3.4/site-package”

“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4″:”/usr/local/lib/python3.4”

After all done you need to referesh remote sources, maybe not but i did. Then pycharm will reindex soruces ,wait a few minites, you can check with command+B jump to external sources , if path changed to your local sites-package location its success.