Django在Google App Engine上的FileField(或ImageField)

时间:2021-07-12 23:13:02

GAE doesn't allow read/write to file system, which is what Django's FileField (or ImageField) is using (via the FileSystemStorage class).

GAE不允许读/写文件系统,这是Django的FileField(或ImageField)正在使用的(通过FileSystemStorage类)。

I was thinking implementing a custom Django storage, but the GAE blobstore seems to be completely incompatible with the Django requirements. Specifically, GAE blobstore assume direct upload from client to store, while Django custom storage need to implement a _save(name, content) method.

我在考虑实现自定义Django存储,但GAE blobstore似乎与Django要求完全不兼容。具体来说,GAE blobstore假设从客户端直接上传到商店,而Django自定义存储需要实现_save(名称,内容)方法。

As far as I can see no one refer to this missing implementation. There are some custom storage projects out there (most notably: django-storages on BitBucket), with implementations for S3, Windows Azure, dozens of other backend, but nothing for Google.

据我所知,没有人提到这个缺失的实现。有一些自定义存储项目(最值得注意的是:BitBucket上的django-storages),S3,Windows Azure,几十个其他后端的实现,但谷歌没有。

What direction should I take to have a FileField in my model, hosted on Google App Engine?

在Google App Engine上托管我的模型中的FileField应该采取什么方向?

To clarify: - I'm using to stocked, trunk, the one that uses Google Cloud SQL Django that comes with Google SDK - I'm not using Django nonrel. - I've followed the Django guide from Google documentation.

澄清: - 我正在使用库存,主干,使用Google SDK附带的Google Cloud SQL Django的那个 - 我没有使用Django nonrel。 - 我从Google文档中遵循了Django指南。

1 个解决方案

#1


1  

blobstore now support writing files feature. see writing file to the blobstore. Therefore it is possible to implement the _save(name, content) with blobstore now.

blobstore现在支持写文件功能。看到写文件到blobstore。因此,现在可以使用blobstore实现_save(name,content)。

Another way is using cloud storage. it provide more features such as listdir, open, delete than blobstore.

另一种方法是使用云存储。它提供了比blobstore更多的功能,如listdir,open,delete。

https://developers.google.com/appengine/docs/python/googlestorage/

#1


1  

blobstore now support writing files feature. see writing file to the blobstore. Therefore it is possible to implement the _save(name, content) with blobstore now.

blobstore现在支持写文件功能。看到写文件到blobstore。因此,现在可以使用blobstore实现_save(name,content)。

Another way is using cloud storage. it provide more features such as listdir, open, delete than blobstore.

另一种方法是使用云存储。它提供了比blobstore更多的功能,如listdir,open,delete。

https://developers.google.com/appengine/docs/python/googlestorage/