baschelik
3/16/2020 - 4:32 PM

DEBUGGING SETUP IN VS CODE

# JSON FILE

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Remote Attach Custom",
            "type": "python",
            "request": "attach",
            "port": 4444,
            "host": "172.18.0.3",
            "pathMappings": [
                {
                    "localRoot": "/home/murgice/Projects/openerp-flexpos",
                    "remoteRoot": "/opt/flexpos_openerp_addons"
                }
            ]
        }
    ]
}

# OPENERP-SERVER FILE

#!/usr/bin/python
import openerp
# import pydevd_pycharm
import ptvsd

try:
    # pydevd_pycharm.settrace('192.168.200.118', port=4444, stdoutToServer=True, stderrToServer=True, suspend=False)
    ptvsd.enable_attach(address=('172.18.0.3', 4444), redirect_output=True)
except:
    pass

if __name__ == "__main__":
    ptvsd.wait_for_attach()
    openerp.cli.main()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: