簡體   English   中英

Django 使用 googledriveapi 在 google drive 中上傳和下載文件

[英]Django upload and download files in google drive using googledriveapi

我是 django 的新手,並試圖創建一個網絡應用程序來使用 gdriveapi 將文件上傳和下載到谷歌驅動器。 我已經瀏覽了 Google 驅動器的 python 快速入門,並嘗試了它正在工作的 manage.py 中的代碼。

如何編寫相同的代碼來獲取憑據並在 django 應用程序中上傳和下載? 如何在django中編寫視圖和模型以獲取憑據並將文件上傳到gdrive?

對於我的模型字段,我使用file = models.FileField(upload_to='todo', storage=gd_storage, blank=True, null=True) ,其中 todo 是應用程序名稱。 對於視圖,我只是使用了通用 ModelViewSet,您可以在其中serializer.save(file=self.request.data['file'])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM