PyCharm 2016.3 Help

Editing Individual Files on Remote Hosts

On this page:

Introduction

Once you've set up synchronization with a remote host, you can open individual files directly from the remote host and edit them in PyCharm, without adding/downloading them to the local project. Note that for such files not included in a project, some PyCharm features are not supported.

To take advantage of debugging, refactorings, and other advanced features, consider including the files into a project; see Accessing Files on Web Servers for details.

Editing files on remote hosts

To edit a file on a remote host

  1. Open the Remote Host tool window. On the main menu, choose one of the following:
    • View | Tool Windows | Remote Host
    • Tools | Deployment | Browse Remote Host
  2. Select the required server configuration from the drop-down list. The tool window shows a tree view of files and folders under the server configuration root. If no relevant server configuration is available in the drop-down list, click the Browse button browseButton.png and configure access to the server in the Deployment dialog box that opens.

    For details, see Configuring Synchronization with a Web Server.

  3. To start editing a file, double click its name or select the file name in the Remote Host Tool Window , and choose Edit Remote File on the context menu:
    /help/img/idea/edit_file_on_remote_host_3.png

    The file opens in the PyCharm editor, without being added or downloaded to the local project.

    /help/img/idea/py_edit_file_on_remote_host_1.png

    When you work with a remote file, a special toolbar appears at the top of the editor, showing the editing status ("The file is identical to the remote one" or "The file has been changed. Upload?".

    Remote files can be easily distinguished from local ones by looking at the annotation, which includes the server name (in our case it is <MyServer>) .

    /help/img/idea/py_edit_file_on_remote_host_2.png

  4. When you are done editing the file, do one of the following:
    • To upload the file to the remote host, click /help/img/idea/upload_current_remote_file.png.
    • To compare the currently opened file with the last uploaded version, click /help/img/idea/compare_current_remote_file.png. The files are opened in the standard PyCharm Difference Viewer, see Differences viewer for files.
    • To discard the changes introduced to the file after the last upload, click /help/img/idea/rollback.png.

As it has been mentioned above, an individual file is not added to a project. As a result, all the changes to it are discarded as soon as you close the file or the currently opened project unless these changes have been uploaded. To prevent losing your data accidentally, PyCharm displays the following dialog box when you attempt to close the edited file or the entire project:

/help/img/idea/py_edit_file_on_remote_host_3.png

See Also

Last modified: 23 November 2016