Jun-09-2022, 11:59 AM
I need to download a file from the SFTP server and store it in local machine,and also upload a file from my local system to the SFTP server.
I need to do this django project
I got a code from google and the code goes like this
Is there any way specific in Django to do this?
I need to do this django project
I got a code from google and the code goes like this
import pysftp Hostname = "remote-ip-address" Username = "root" Password = "password" with pysftp.Connection(host=Hostname, username=Username, password=Password) as sftp: print("Connection successfully established ... ") # Define the remote path where the file will be uploaded remoteFilePath = '/etc/hosts' # Define a file that you want to upload from your local directorty localFilePath = '/opt/hosts' # Use get method to download a file sftp.get(remoteFilePath, localFilePath)how do i accomodate this in Django project ?
Is there any way specific in Django to do this?