Tutorial: Attaching Visual Studio Code to Devstack LMS Container

@viadanna This seems like a potential fix whenever the LMS restarts after a save to say private.py and it autoreloads. I added this to the top of /edx/app/edxapp/edx-platform/lms/envs/private.py file. Found the solution here https://blog.hipolabs.com/remote-debugging-with-vscode-docker-and-pico-fde11f0e5f1c. After the LMS restarts you still need to remember to issue a VS Code > Run > Start Debugging to get it to attach for debugging in that workspace. Seems like this works fine. Let me know what you think.

############## Remote Container Debugging for LMS with VS Code #########################
# https://opencraft.com/blog/tutorial-attaching-visual-studio-code-to-devstack-lms-container/
# https://blog.hipolabs.com/remote-debugging-with-vscode-docker-and-pico-fde11f0e5f1c
# Make sure the LMS enables debugging via ptvsd. 

import os
import subprocess

ENABLE_DEBUGGER_PARAM = "python"
def start_ptvsd_debugger():
    parent_pid = os.getppid()
    cmd = "ps aux | grep %s | awk '{print $2}'" % ENABLE_DEBUGGER_PARAM
    ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
    pids = ps.communicate()[0].split('\n')

    if str(parent_pid) in pids:
        print('Starting ptvsd debugger')
        import ptvsd
        ptvsd.enable_attach(address=('localhost', 5678), redirect_output=True)

start_ptvsd_debugger()