推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
limyel
V2EX  ›  Python

请问同步盘的本地与服务器同步是如何实现的?

  •  
  •   limyel · Oct 19, 2019 · 3906 views
    This topic created in 2450 days ago, the information mentioned may be changed or developed.

    毕设想做一个类似坚果云的同步盘(简略粗糙版),web 端 打算用 Django 或者 Flask。

    但是本地与服务器同步这里遇到了个问题:因为需要运行一个 web 端,所以本地与服务端同步、传输文件是直接向 web 发起 http 请求还是再在服务端写一个 socket 来处理?

    不知道我这样描述有没有清楚...感觉就是同步、传输文件是用 BS 还是 CS ?

    希望 v 站的前辈们给点想法哈

    8 replies    2019-10-20 21:05:42 +08:00
    caola
        1
    caola  
       Oct 19, 2019
    linux 自带的 rsync 就能满足大多数的同步需求 (
    janxin
        2
    janxin  
       Oct 19, 2019 via iPhone
    BS 还有 websocket 实现实时通讯呢。答案肯定是都可以啦
    ztcaoll222
        3
    ztcaoll222  
       Oct 19, 2019
    自己实现一个 rsync, 我记得 zlib 有相关的函数
    realpg
        4
    realpg  
    PRO
       Oct 19, 2019
    怎么都行 你甚至可以直接内嵌个 rsync
    Trim21
        5
    Trim21  
       Oct 19, 2019 via Android
    都可以 你甚至可以直接把整个文件 post 上去,然后服务端替换掉硬盘上的文件

    我之前写过一个 python 的同步盘服务器是这么干的(
    limyel
        6
    limyel  
    OP
       Oct 20, 2019
    @caola
    @ztcaoll222
    @realpg

    感谢指点!
    limyel
        7
    limyel  
    OP
       Oct 20, 2019
    @Trim21

    这样的话服务端同步到客户端怎么做呢
    Trim21
        8
    Trim21  
       Oct 20, 2019
    @limyel #6 我当初偷懒直接搞了客户端定期检查,应该有更好的方案比如 websocket 之类的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1155 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 23:48 · PVG 07:48 · LAX 16:48 · JFK 19:48
    ♥ Do have faith in what you're doing.