Like rsync for local folders from Django view

I have a website that requires a registered administrator to enter an intermediate database into the real-time database. The first thing he does is reset sql and click on the target database. This works fine, but when I go to the rsync folders containing the downloaded material, I get an error message. This ONLY happens when a script is called from a view, not from the command line or python shell. Here is the function:

def copy_media(self, origin_folder, target_folder):
    command_string = "rsync -a %s %s" % (origin_folder, target_folder)
    return_code = subprocess.call(command_string, shell=True)
    return return_code

The return code is "12" when it is erroneous. My best guess is that since there is a significant delay before the script completes, the view does not know how to properly wait for the completion. Another suggestion that I had was that the paths somehow turned inside out.

+5
source share
2 answers

Check the permissions of your server, these can be different user rights / permissions when you use the command line and, therefore, cannot execute this command.

+1
source

, "django" . rsync os.chown(path, uid, gid) , -.

, rsync -avzP, , / , , .

+2

All Articles