PyCharm:远程开发 [英] PyCharm: Remote Development

查看:64
本文介绍了PyCharm:远程开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 PyCharm 连接到远程服务器以进行远程开发?

  • 所有文件(代码和数据)都在远程服务器上.
  • 开发(添加/编辑文件)将在远程服务器上进行.
  • 程序将在远程服务器上运行

我希望 PyCharm 充当该远程系统的可视化界面?(类似于终端 --> ssh --> vim 但带有漂亮的 PyCharm IDE)

解决方案

这个配置比看起来更简单.

创建服务器配置:指定其名称、类型和可见性

  1. 打开部署页面:

    • Mac ⌘, Windows 和 Linux 文件 |设置,然后单击构建、执行、部署下的部署.

    • 选择<代码>工具|部署 |主菜单上的配置.(见下图)

  1. 在显示所有现有服务器配置列表的左侧窗格中,单击添加 +.添加服务器对话框打开.

  1. 名称文本框中指定服务器配置名称.从类型下拉列表中,根据您将用于与服务器交换数据的协议选择服务器配置类型.有关

    1. 在本地路径文本框中,指定项目树中所需文件夹的完整路径.在最简单的情况下,它是项目根目录.

    2. 在部署路径文本框中,指定服务器上的文件夹,PyCharm 将从本地路径文本框中指定的文件夹上传数据.键入相对于服务器配置根目录的文件夹路径.

    3. 在 Web 路径文本框中,键入服务器上相对于服务器配置根目录的文件夹路径.实际上,输入您在部署路径文本框中输入的相对路径.

    如何配置更改文件自动上传到默认服务器

    1. 打开选项对话框:

      • Windows/Linux:<代码>文件 |设置 |构建、执行、部署 |部署 |选项
      • MacOS X:<代码>PyCharm |偏好 |构建、执行、部署 |部署 |选项

    1. 从自动上传更改的文件到默认服务器列表中,选择:

      • 始终,上传任何手动或自动保存的文件
      • 在显式保存操作中,仅上传手动保存的文件
      • 从不,禁止自动上传

    就是这样!您已准备好开始开发.

    我刚刚收集了官方 PyCharm 文档,并且我添加了一些图像,这些图像可能会指导那些更具视觉导向的图像.

    How can I connect PyCharm to a remote server in order to do remote development?

    • All the files (code and data) are on a remote server.
    • The development (adding/editing files) will happen at the remote server.
    • The program will run on the remote server

    I want PyCharm to act as a visual interface to that remote system? (something like terminal --> ssh --> vim but with nice PyCharm IDE)

    解决方案

    This configuration is simpler than it seems.

    Creating a server configuration: specifying its name, type, and visibility

    1. Open the Deployment page:

      • On Mac ⌘, on Windows and Linux File | Settings and click Deployment under Build, Execution, Deployment.

      • Choose Tools | Deployment | Configuration on the main menu. (see image below)

    1. In the left-hand pane, that shows a list of all the existing server configurations, click Add +. The Add Server dialog box opens.

    1. Specify the server configuration name in the Name text box. From the Type drop-down list, choose the server configuration type depending on the protocol you are going to use to exchange the data with the server. For more info about available protocols (FTP, SFTP, FTPS).

    2. Use the Visible only for this project checkbox to configure the visibility of the server access configuration.

    3. Click OK. The Add Server dialog box closes and you return to the Connection tab of the Deployment dialog box.

    Mapping local folders to folders on the server and the URL addresses to access them

    1. Switch to the Mappings tab.

    1. In the Local Path text box, specify the full path to the desired folder in the project tree. In the simplest case it is the project root.

    2. In the Deployment Path text box, specify the folder on the server where PyCharm will upload the data from the folder specified in the Local Path text box. Type the path to the folder relative to the server configuration root.

    3. In the Web Path text box, type the path to the folder on the server relative to the server configuration root. Actually, type the relative path you typed in the Deployment Path text box.

    How do I configure automatic upload of changed files to the default server

    1. Open the Options dialog:

      • Windows/Linux: File | Settings | Build, Execution, Deployment | Deployment | Options
      • MacOS X: PyCharm | Preferences | Build, Execution, Deployment | Deployment | Options

    1. From the Upload changed files automatically to the default server list, choose:

      • Always, to upload any manually or automatically saved file
      • On explicit save action, to upload only manually saved files
      • Never, to suppress automatic upload

    That's it! You are ready to start developing.

    I have just collected the most relevant information that is available in the official PyCharm documentation, and I have added some images that might guide the ones that are more visually oriented.

    这篇关于PyCharm:远程开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆