Python client and server for file sync across multiple machines
Ptyhon 3.6 or later
Create virtual environment:
python3 -m venv venv
Activate the virtual environment:
source venv/bin/activate
Install the requirements:
pip install -r requirements.txt
The client is built with the install.sh
script.
You will needpyinstaller
installed.
cmod +x install.sh
./install.sh
This will create a dist
directory with the client executable.
Add the executable to your PATH.
export PATH=$PATH:$PWD/dist
The client takes a directory and a server address to sync with.
watcher ./data http://localhost:8000
The above command will watch the directory ./data
for created files and upload them to the server.
Run the server with the uvicorn
command.
uvicorn server:app
This will start the server on port 8000.
[OPTIONAL] - You can be notified when a file is uploaded to the server by email.
To enable email notifications add the following environment variables to your shell:
export GMAIL_USER='<your_gmail_user>'
export GMAIL_PASSWORD='<your_gmail_password>'
It will use those to connect to your gmail account and send an email when a file is uploaded.
Read more about it in this article