【发布时间】:2015-09-14 14:49:41
【问题描述】:
我正在尝试使用 AzureStorage 将 azure storage 与 django 1.7 app 连接起来。
models.py
from django.db import models
from myproject.storage import AzureStorage
class MyModel(models.Model):
my_file = models.FileField(upload_to="files", storage=AzureStorage(container="media"))
my_image = models.ImageField(upload_to="images", storage=AzureStorage(container="media"))
但是当我尝试进行迁移时,我得到了:
ValueError: Cannot serialize: <myproject.storage.AzureStorage object at 0x7f85185e66d0>
There are some values Django cannot serialize into migration files.
For more, see https://docs.djangoproject.com/en/dev/topics/migrations/#migration-serializing
究竟是什么不能序列化?
【问题讨论】:
-
也许是 modified_time ...尝试调试它...它只有 64 行代码,2 年内没人更新:D
-
将@deconstructible 添加到 AzureStorage 类可修复此错误
标签: python django azure azure-storage azure-blob-storage