Setup PyCharm remote debugger¶
The remote debugger in PyCharm works slightly differently from the standard debugger. Before using it, you must first set up a remote debug server in PyCharm. Once your application starts, it will try to connect to the remote debug server. If the connection fails, it won’t retry automatically—you’ll need to restart the application to try again. If the connection is successful, you can use the PyCharm debugger as usual (e.g., setting breakpoints, stepping through code, etc.).
Note
This feature is only available in the PyCharm Professional Edition.
Setup PyCharm to Run Remote Debugger Server¶
To set up the remote debugger server in PyCharm, refer to the official JetBrains documentation: https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config
Source Code Mappings¶
Below is a table with the required local-to-remote source code mappings and port configurations:
Project Name |
Local Source Code Path |
Remote Source Code Path |
Port |
---|---|---|---|
VCS Server |
<local path>/rhodecode-vcsserver |
/home/rhodecode/rhodecode-vcsserver |
5678 |
CE |
<local path>/rhodecode-enterprise-ce |
/home/rhodecode/rhodecode-enterprise-ce |
5678 |
EE (requires both CE and EE mappings) |
<local path>/rhodecode-enterprise-ce |
/home/rhodecode/rhodecode-enterprise-ce |
5678 |
<local path>/rhodecode-enterprise-ee |
/home/rhodecode/rhodecode-enterprise-ee |
5678 |
Enable Remote Debugging in the Application¶
You can configure remote debugging by setting environment variables defined in the file: <local path>/rhodecode-docker/docker-compose-apps.dev.yaml.
To enable remote debugging, set the appropriate environment variable(s) to ‘1’.
Note
This setup assumes the application runs inside a Docker container. If it’s not running in Docker, it may fail to resolve the host machine’s IP address.
ENV Variable |
Description |
---|---|
PYCHARM_DEBUG |
Enables remote debugging. The application will attempt to connect to your PyCharm debug server. |
PYCHARM_DEBUG_PAUSE_AT_STARTUP |
Pauses execution immediately after connecting to the remote debug server (acts like a breakpoint at startup). |