7
我使用django存储与s3boto后端。根据这个问题,http://code.larlet.fr/django-storages/issue/5/s3botostorage-set-content-type-header-acl-fixed-use-http-and-disable-query-auth-by我有一堆文件(所有这些)的内容类型为'application/octet-stream'。鉴于我有一个<class 'boto.s3.key.Key'>
的实例,我如何设置content_type?使用boto,在s3上已经存在的文件上设置content_type
In [29]: a.file.file.key.content_type
Out[29]: 'application/octet-stream'
In [30]: mimetypes.guess_type(a.file.file.key.name)[0]
Out[30]: 'image/jpeg'
In [31]: type(a.file.file.key)
Out[31]: <class 'boto.s3.key.Key'>