Chapter 4 PyCharm
PyCharm is a Python IDE from JetBrains which offers nice features like Remote Deploy and repository management. For students PyCharm is free to use. You just must make a user account with your university Email on the JetBrains website.
4.1 PyCharm Git Repository
Open a new Project.
Go to VCS and select Get from Version Control
- Click on GitHub
- Click on Login via GitHub
- You get redirected to a JetBrains site. 6. Click on “Authorize in GitHub”
- Enter your credentials
- If it is successful choose the gateway repository from the list and click “clone”.
If the Error message “Git is not installed” appears you can click on it to install on your machine. After git is installed you have to repeat the steps 2. 3. 7.
Afterwards your IDE should looks like this:
You can now work within the gateway code. To change the branch, where you are working, go to the right bottom corner of PyCharm. And click on the “branch” symbol. All branches in the repository are shown pick your branch and press Checkout.
4.2 RemoteDeploy
To run the code on your raspberry pi you must make a remote deploy connection. We show you how to do this in this chapter:
- Open Tools
- Choose Deployment
- Click on Configutarion
- Press the plus sign in the top left corner of the deployment window:
- Choose SFTP and give the server a name.
- Press the “…” Button next to SSH configuration and press the plus sign in the top left corner.
- Now enter the Ip from your pi. Which you can find out with Chaper XX. Enter the pi User name and your pi password.
- Test the connection with the Test Conenction Button. Accept the upcoming windows. If the connection is successful press the ok button.
- Now we must choose the deployment path. Change to the mappings tab and click on the folder Symbol next to Deployment Path:
- Choose your file path via dropdown. Note the file must be in the home directory to prevent failures.
- Click File > Settings
- Go to Python Interpreter and click the sprocket on the right sight
- Choose add and click on SSH Interpreter and tick Existing Server configuration.
- Choose your ssh connection and click next
- Change your Sync folder. Click on Folder icon on the right side
- Click on the Remote Path side again on the Folder Symbol
- Select your path from 9
- Click ok buttons until your back on your main screen.
- If installations are requiered press the „Install requirements in the top right corner
- Now you can run the code on remote. All changes will be transmitted automatically to the raspberry pi