Need to download Pycharm professional version
connection container
- Open Tools/Development/Configulation
- Click the + logo and select SFTP
- enter a name
- Enter Connection, click on the three dots behind SSH, and configure the connection.
Note: The port configured above must be mapped to the port after the ssh port inside the container. The implementation method is to write a port mapping port 22 in the dockerfile. (You must add quotation marks when mapping port 22)
- After completion, click OK to enter the Mapping directory.
A big pitfall of pycharm is: remote debugging, which requires downloading the code to the local computer first. That's why here is the configuration of local and remote code paths.
- At this point, the configuration is complete, then select Tools/Development/Browse Remote Host to see the path in your container on the side.
Connect to the python environment in the remote container
- Go to File | Settings | Project: web_api_source_code | Python Interpreter | Add and select On ssh
- Fill in the information and click next
- enter password
- Start the connection, wait until the connection is completed, and click next
- Select the environment
and then enter the System Interpreter. In the Sync folders, you need to select your project file. Generally, it will be the default here, but please note that this default is wrong and must be changed.
- After the top-level create is configured, it has successfully connected to the python environment in your container.
[It is not easy to write articles. If you need to forward them, please contact the author! 】