Python Forum
Help setting up Pycharm & Remote Pi
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help setting up Pycharm & Remote Pi
#1
First, I am new to both PyCharm and the tornado web server.
I am trying to setup a configuration to run the tornado web server with PyCharm and a remote raspberry Pi. The Pi home directory is connected using SFTP as drive Z. So in Pycharm, the path to my wind sketch is "Z:\home\pi\wind\wind.py" This configuration seems to work but there is a huge problem that I haven't been able to resolve.

So far I have only been able to get it to work by using SSH into the pi and in that sketch directory (wind) executing: "python wind.py&"
That gets the server running successfully on the pi. But if I change the sketch so Hello World becomes Goodbye World and run it PyCharm tells me it is already running and asks if I want to close it and restart. I say yes, but subsequent connections still show "Hello World".
In order to fix that, I kill wind, and then type python wind.py& again. Having to do that every time I update the code is not feasible.
What do I need to do to make it easier to stop wind on the pi and restart it automatically with the changed sketch.

The tornado server is setup with the example Hello World sketch which I named wind.py
import tornado.ioloop
import tornado.web


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, World")


def make_app():
    return tornado.web.Application([
        (r"/", MainHandler),
    ])


if __name__ == "__main__":
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()
Current configuration:
  • Windows 10
    SFTF 2.0.7877
    PyCharm Community 2021.2.2
Reply
#2
So I figured out that even though the source script is on the Raspberry Pi, when I run the script from PyCharm the script is running on the PC.

So I guess the question becomes how can I configure things to edit the script that is located on the pi and run the script on the pi, all from PyCharm on the PC?
Reply
#3
Take a look at this or related articles:

https://www.jetbrains.com/help/pycharm/r...oduct.html
Reply
#4
(Sep-16-2021, 08:32 PM)deanhystad Wrote: Take a look at this or related articles:

https://www.jetbrains.com/help/pycharm/r...oduct.html

I tried to follow the instructions, "From the main menu, choose Run| Edit Configuration.... The Run/debug configurations dialog opens. You have to click Add configuration on the toolbar, and from the list of available configurations, select Python Debug Server."

The problem is in the community version 2021.2.2 there is no option there for "Python Debug Server"
Is it possible this is only available in the paid versions?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  setting working directory in pycharm saisankalpj 10 13,120 Dec-06-2018, 07:58 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020