Guneshs
Posts: 48
Joined: Sun Jun 25, 2017 4:18 pm

Rclone setup with a django application

Fri Feb 09, 2018 7:37 pm

I have created an application using django framework.
I was trying to use rclone to backup my images to google drive from rpi.

Code: Select all

rclone -v move /home/pi/Desktop/Project/html_server/picturestaken remote:rclone --delete-after --include *.jpg --include *.log

Code: Select all

2018/02/10 00:51:18 INFO  : Google drive root 'rclone': Modify window is 1ms
2018/02/10 00:51:19 INFO  : Google drive root 'rclone': Waiting for checks to finish
2018/02/10 00:51:19 INFO  : Google drive root 'rclone': Waiting for transfers to finish
2018/02/10 00:51:22 INFO  : ThirdEye_2018_02_09_19_03_35.jpg: Copied (new)
2018/02/10 00:51:22 INFO  : ThirdEye_2018_02_09_19_03_35.jpg: Deleted
2018/02/10 00:51:23 INFO  : ThirdEye_2018_02_09_18_40_00.jpg: Copied (new)
2018/02/10 00:51:23 INFO  : ThirdEye_2018_02_09_18_40_00.jpg: Deleted
2018/02/10 00:51:23 INFO  : ThirdEye_2018_02_09_19_47_19.jpg: Copied (new)
2018/02/10 00:51:23 INFO  : ThirdEye_2018_02_09_19_47_19.jpg: Deleted
2018/02/10 00:51:24 INFO  : ThirdEye_2018_02_09_19_00_24.jpg: Copied (new)
2018/02/10 00:51:24 INFO  : ThirdEye_2018_02_09_19_00_24.jpg: Deleted
2018/02/10 00:51:24 INFO  :
Transferred:   83.274 kBytes (8.205 kBytes/s)
Errors:                 0
Checks:                 4
Transferred:            4
Elapsed time:       10.1s
Moving images to drive works with rclone.

But when i try to include above rclone command with my django application it fails to find rcone.conf.
I have used this weblink as a guide for rclone set-up.
https://www.hackster.io/uladzislau-bayo ... ted-048422
But there are two warnings in the guide:

Code: Select all

IMPORTANT:

Please keep in mind there can be new storage types under "Type of storage to configure" step, so just double check you select right cloud type.
If you are going to call rclone from other application you need to copy rclone.config to the .config folder under application's root and assign owner and group to it same as application uses:

Code: Select all

sudo mkdir -p /SOME_APP/.config/rclone
sudo cp /home/pi
sudo chown -R some_owner:some_group /SOME_APP/.config  
What I did or tried?
I tried the first command :
It created a directory in "/" directory as

Code: Select all

/html_server/.config/rclone
tried second command:
It gave me as no destination directory.
so i manually copied "rclone.conf" file to the newly created ".config" directory.
then i ran the third command:

Code: Select all

 sudo chown -R pi:pi /html_server/.config  
But still my rclone command integrated with the my application doesnot work.
It gives me an error as

Code: Select all

2018/02/09 19:47:46 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
2018/02/09 19:47:46 Failed to create file system for "remote:rclone": didn't find section in config file
Please help.
Thanks

Guneshs
Posts: 48
Joined: Sun Jun 25, 2017 4:18 pm

Re: Rclone setup with a django application

Sun Feb 18, 2018 2:35 pm

Adding

Code: Select all

--config some_config_file
to the rclone command solved my issue.:)

Return to “Advanced users”