The whole process of pychart connecting to remote server and remote debugging

Time:2022-6-19
catalogue
  • Connect to remote server
  • Synchronization code
  • Configure remote interpreter for debugging
  • summary

Connect to remote server

1. Click Tools, click deployment, and click configuration

2. Add a link to SFTP protocol

3. Name the link

4. Configure server information

Select the connection tab page, enter the remote server address, user name and password, and click test connection

If the pop-up connection is successful, it indicates that the remote server configuration is successful

5. Configure synchronization content

Select the mappings tab page to configure the path where the local project is located and the path where the remote server project is located. In this way, code synchronization can be performed manually as long as one party makes modifications

6. Open SSH connection on terminal

Click Tools and deploy start SSH session

Select the remote server to connect to

If the terminal terminal of pychart displays the corresponding server information, it indicates that the remote server is connected and can be operated like the server terminal

be careful:If the terminal terminal of pychart is garbled in Chinese, you need to modify the tools configuration of pychart

Click files → settings in the upper left corner, and click Tools to change the format to UTF-8

7. View remote server directory structure

Click Tools, click deployment, and click Browse remote host

On the right side of pycharm, you can view the directory structure of the remote server

Synchronization code

Click Tools, click deploy

If you want to synchronize the local code to the remote server, click upload to deepin (deepin is the name of the remote host)

If you want to pull code from the remote server, click download from deepin (deepin is the name of the remote host)

If automatic upload (always) is checked, then if you modify the code locally, pycharm will automatically synchronize the code to the remote server (this is not recommended in real projects, which will cause code conflicts. Of course, GIT will be used in real projects. It doesn’t matter if you own a private server)

Configure remote interpreter for debugging

In some cases, the versions of some libraries of the Python interpreter on the remote server are inconsistent with those on the local server, or some libraries under windows are different from those under Linux, which will cause the code to run normally on the local server, but run abnormally on the remote server.
In this case, you can configure the Python interpreter in the remote server in pycharm for debugging

1. Click files → settings in the upper left corner, click project interpreter, and click Add

2. Select SSH interpreter, existing server configuration, and remote server

3. Configure the path where the Python interpreter is located

Generally, the selected Python interpreter version is python3, and the path is /usr/bin/python3

If the virtual environment is also configured on the remote server, you can select the python3 file under the directory where the virtual environment is located

summary

This is the end of this article about pypharm connecting to the remote server and remote debugging. For more information about pypharm connecting to the remote server, please search the previous articles of developeppaer or continue to browse the following articles. I hope you will support developeppaer in the future!