python - Django 应用程序中的 Azure 云存储配置错误 : Could not load Azure bindings

标签 python django azure

我正在尝试为我的 Django 应用程序(托管在具有 Ubuntu 操作系统的 Azure VM 上的应用程序)设置 Azure 云存储。我已将 Django-storages 安装为软件包,并且按照以下步骤操作: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 存储图像(两周内一切正常)。当我用 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")

最佳答案

听起来您还没有安装 Azure 的 Python 绑定(bind)。您可以使用以下命令安装它们:

pip install azure

安装文档为here .

关于python - Django 应用程序中的 Azure 云存储配置错误 : Could not load Azure bindings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34266346/

相关文章:

python - 如何在重写 get 方法中返回常规响应,Django

azure - 通过ARM模板在存储帐户中部署多个容器

python - 输入字典 : values that are lists

python - 使用 numpy/scipy 在 python 中均匀有效地采样整数

python - 如何抑制 IPython 启动消息?

Django:发布重定向后,在表单上提供验证错误反馈

python - Appengine 将远程服务器数据下载到本地数据存储失败?

python - 通过 Django Rest 发送文件

Azure 门户 - 无法访问 SQL Server 数据库

azure - 从 Azure BLOB 存储在 Azure SQL DW 中创建外部表