1、Need to prepare tools
xftp: upload project files
Local download address:https:///softs/
xshell: connect to Linux system to debug and execute commands
Local download address:https:///softs/
PyCharm: debugging python code
These programs can be downloaded by searching online
2. Prepare a small project
For example, my library management system project
3. Server virtual environment
This can be created in xshell using the following command:
python3 -m venv new_book
new_book is the file name, which can be customized.
4. Project synchronization to the server
Synchronize the local project and upload it to the server as follows:
Create a remote configuration to make a connection to the server
Select sftp
Create an ssh connection:
Configure the remote folder:
Once configured you can synchronize the code to the remote server:
5. Use xshell to activate the remote server virtual environment
The order is:
source new_book/bin/activate
Import all third-party libraries
pip install -r
6. Local virtual environments connect to remote server virtual environments
file->settings->Project:book_master->python interpreter
Add an ssh interpreter.
Configure the project address:
Edit the local virtual environment and select python3 for the remote server
So that the debugging mode can start the remote service, when the breakpoints in PyCharm, in the browser to access the domain name, the local breakpoints will work as well, which is helpful for debugging want to paypal sandbox such online debugging services.
take note of
center
1、Requires modification ALLOWED_HOSTS = ['*'] # Allow full network access
You need to open the security group of the port used in the cloud server console, for example, mine is 8055, you need to go to Huawei Cloud to open the security group
Effect:
To this article on the Pycharm synchronization remote server debugging method steps to this article, more related Pycharm synchronization remote server debugging content, please search my previous articles or continue to browse the following related articles I hope you will support me in the future more!