![]() ![]() You may need elevated privilege for listening on port 80 (for real production usage give this privilege to the current user, do not sudo the process). We will make sure that machine 234.56.45.89 can be contacted from the outside world on port 80.įirstly, using an SSH session on remote machine we will start a webserver using the following Python3 command. We use the good old port 80 for the communication (the usual port for http).īefore doing anything else we need to make sure that our remote VM network configuration is ok. To make things simpler we decided to show an example where the Python process is executed on a remote machine whose IP address is 234.56.45.89 (I chose this address randomly). We will try to simplify things so the debugging experience becomes crystal clear. The VSCode documentation is fuzzy about whether to use IP or localhost which port to set etc. Obviously network communication is involved here and that is actually the major pitfall when configuring remote debugging. The remotely executed Python waits until the client debugging agent is attached. The magic lies in a library called ptvsd that makes the bridge for attaching local VSCode to remotely executed process. py files on client and in host so that the debugging process is able to match line by line the two versions. Therefore, it is important to keep exactly the same. With remote debugging only a single Python process is executed on the remote VM then, on client computer, VSCode “attach itself” to this remote process so you can match the remote code execution with your local files. In this post, the name remote stands for our Ubuntu VM on Azure while the client is our local, e.g. Let us present precisely what remote debugging is. Note that in VSCode documentation SSH portforwarding is mentioned but we will ignore it for now. We assume now that the reader has an Azure Ubuntu server running and is able to logon through SSH. are independent so you can basically choose anything. In this blog post we used an Ubuntu Azure Virtual Machine. In addition, we assume that the reader knows how to logon on a remote machine using SSH. We assume that the reader is familiar with the usage of a debugger in VSCode. ![]() Precisely, we do not care about MITM interceptions between our client and remote server. We will discuss in appendix how we could solve this using SSH portforwarding. We will assume that we do not have any security constraints. Use remote debugging capabilities of VSCode with Python Prerequisite In this blog post we will provide more explanations. Actually VSCode documentation provides some very short instructions. In this blog post I propose to review the setup of Python remote debugging with the portable and popular code editor VSCode. Remote debugging can be very helpful: it is possible to execute code on a remote machine and benefit from a nice debugging experience locally in your favorite code editor. I truly think that no matter what your platform is, you must have access to a comfortable development environment and a working debugger is one of the most important part of it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |