ImportError: cannot import name 'BlobService' when using Azure Backend

前端 未结 5 1721
陌清茗
陌清茗 2020-12-10 07:02

I followed these instructions to set up Azure as my backend service: http://django-storages.readthedocs.io/en/latest/backends/azure.html

Also added additional packag

5条回答
  •  清歌不尽
    2020-12-10 07:39

    When you pip install azure, you installed azure-storage 0.34.3 (tutorial 1). When you followed the second tutorial, you installed azure-storage-blob 0.37.0. This is where you got issues, there is massive breaking changes in 0.37.0 in the namespaces:

    https://github.com/Azure/azure-storage-python/blob/master/BreakingChanges.md#version-0370

    See in the ChangeLog that azure-storage <= 0.36 is incompatible with azure-storage-blob >= 0.37. You silently replaced some code file of 0.34.3 by 0.37.0 version.

    In you second test, you said you did:

    pip3 install azure-storage-blob
    pip3 install azure
    

    Package are still incompatible, but you did it in a reverse order, where you crushed your 0.37.0 version with the 0.34.3 one this time. It's why it works.

    TLDR, someone needs to update django-storages to support azure-storage-blob >= 0.37.0. In the mean time, stick to azure-storage <= 0.36 and DON'T install azure-storage-blob at all.

提交回复
热议问题