使用天蓝色作为Django的一个存储后端(使用Django的货仓) [英] Using azure as a storage backend for Django (using django-storages)
问题描述
我使用我在过去使用AWS与S3合作Django的存储。但随着微软Azure我遇到这回在谷歌没有结果错误。
I am using django-storages which I have used in the past to work with AWS S3. But with Microsoft Azure I am running into errors which return no results on google.
我使用的Python 3和Django的1.8.4发展。我使用Django的存储器和Django的存储器,终极版的巨蟒-3支持。
I am developing using python 3 and Django 1.8.4. I am using django-storages and django-storages-redux for python 3 support.
致电时 ./ manage.py collectstatic
,输入是
我得到两个错误(!):
When calling ./manage.py collectstatic
and enter yes
I get two (!) errors:
Traceback (most recent call last):
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/storages/backends/azure_storage.py", line 44, in exists
self.connection.get_blob_properties(
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/storages/backends/azure_storage.py", line 34, in connection
self._connection = azure.storage.BlobService(
AttributeError: 'module' object has no attribute 'BlobService'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect
handler(path, prefixed_path, storage)
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 305, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 218, in delete_file
if self.storage.exists(prefixed_path):
File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/storages/backends/azure_storage.py", line 46, in exists
except azure.WindowsAzureMissingResourceError:
AttributeError: 'module' object has no attribute 'WindowsAzureMissingResourceError'
我也跟着用Django的存储器天青这里的微薄说明
任何想法可能会导致这个错误?有没有人成功地部署一个Django 1.8的应用程序与蔚蓝作为存储和静态文件的后端?
Any Idea what might be causing this error? Has anyone succesfully deployed a django 1.8 app with azure as a storage and static files backend?
的编辑:的我已经绕Django的存储器模块中的位黑客:
使用
edit: I have hacked around a bit in the django-storages module: Using
import azure.storage.blob
self._connection = azure.storage.blob.blobservice.BlobService(
而不仅仅是
self._connection = azure.storage.BlobService(
但现在我得到不同的错误,这让我相信这个问题实际运行更深。
But now I am getting different errors which makes me believe that this problem actually runs deeper.
推荐答案
我已经找到了问题:
Django的存储器 - 终极版仅仅是过时的,与湛蓝的SDK的最新版本
django-storages-redux is simply outdated and not compatible with the newest version of the azure sdk
由作者pull请求是在作品:
a pull request by the author is in the works:
https://github.com/jschneier/django-storages/pull/86
我做了我自己的quickfix这里:
I did my own quickfix here:
https://github.com/schumannd/django-storages
这篇关于使用天蓝色作为Django的一个存储后端(使用Django的货仓)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!