我使用的是過去曾使用過的AWS S3的django-storages。但是,對於Microsoft Azure,我遇到了在Google上沒有任何結果的錯誤。使用azure作爲Django的存儲後端(使用django-storages)
我正在開發使用python 3和Django 1.8.4。我正在使用django-storages和django-storage-redux for python 3支持。
當調用./manage.py collectstatic
並進入yes
我得到兩個錯誤(!):
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的儲存與蔚藍here微薄的指令。
任何想法什麼可能會導致此錯誤?有沒有人成功部署了一個django 1.8應用程序,其中azure作爲存儲和靜態文件後端?
編輯:我已經破解周圍的Django的存儲器模塊中的位: 使用
import azure.storage.blob
self._connection = azure.storage.blob.blobservice.BlobService(
,而不是僅僅
self._connection = azure.storage.BlobService(
但現在我得到不同的錯誤,這使得我相信這個問題實際上更深入。