Answer the question
In order to leave comments, you need to log in
What's the best way to use Django + multiple SSH connections?
Now I have it implemented in such a way that when I enter the page, I connect via SSH to the device, after that I can perform any actions, but without a connection. I use paramiko. In code it looks like this
client = paramiko.SSHClient()
def connect(ip, port, user, pass):
client = paramiko.connect()#и так далее
def ls():
client.exec_command('ls')# и так далее
Answer the question
In order to leave comments, you need to log in
Run on a separate thread for each ssh connection. Synchronize streams through an external message bus, for example, you can implement it through redis, simply and cheaply.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question