Django file upload with FTP backend

后端 未结 2 888
天涯浪人
天涯浪人 2021-02-04 18:34

I want to upload my files based on the example Need a minimal Django file upload example, however I want to store the files not locally, but on another server with the use of FT

2条回答
  •  醉酒成梦
    2021-02-04 19:11

    Try this

    models.py

    from storages.backends.ftp import FTPStorage
    fs = FTPStorage()
    

    settings.py

    DEFAULT_FILE_STORAGE = 'storages.backends.ftp.FTPStorage'
    FTP_STORAGE_LOCATION = 'ftp://user:password@localhost:21'
    

提交回复
热议问题