我正在尝试为我的Django应用程序(使用Ubuntu OS在Azure VM上托管的应用程序)设置Azure云存储。我将Django-storage作为一个软件包安装,我按照这个:http://django-storages.readthedocs.org/en/latest/backends/azure.html,将以下行添加到我的 settings.py 文件中:
DEFAULT_FILE_STORAGE = 'storages.backends.azure_storage.AzureStorage'
AZURE_ACCOUNT_NAME = 'photodatabasestorage'
AZURE_ACCOUNT_KEY = 'something'
AZURE_CONTAINER = 'somecontainer'
在此之前,我使用类似的设置通过Amazon S3存储图像(一切都运行良好,为期2周)。我用Azure代码替换S3代码的那一刻,我开始收到以下错误:
例外值:
**Could not load Azure bindings.** See
https://github.com/WindowsAzure/azure-sdk-for-python
Exception Location:
/home/mhb11/.virtualenvs/myvirtualenv/local/lib/python2.7/site-packages/storages/backends/azure_storage.py
in <module>, line 12?
这是有问题的代码段:
from django.core.exceptions import ImproperlyConfigured
try:
import azure
import azure.storage
except ImportError:
raise ImproperlyConfigured(
"Could not load Azure bindings. "
"See https://github.com/WindowsAzure/azure-sdk-for-python")