Django 中的 Azure Blob 存储错误 - 无法建立新连接:[Errno 111]

问题描述

我正在使用 Docker 容器和 Docker-compose 设置本地 Azure Blob 存储。 但是,当我开始创建 blob 容器并上传文件时,它会引发如下错误。

NSComboBox ControlSize: 
large/regular height = 25;
small height = 22;
mini height = 22;

这是我的 docker-compose:

azure.common.AzureException: HTTPConnectionPool(host='127.0.0.1',port=10000): Max retries exceeded with url: /devstoreaccount1/quickstartblobs?restype=container (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f1068d0f748>: Failed to establish a new connection: [Errno 111] Connection refused',))

需求.txt

version: "3.9"
   
services:
 
      
  db:
    image: postgres
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - DEBUG=FALSE
      - AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1;
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - 8000:8000
      - 5678:5678
    depends_on:
      - db
      
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    ports:
      - "127.0.0.1:10000:10000"

代码:

djangorestframework==3.11.2
Django==3.1.8
Pygments==2.7.4
Markdown==3.2.1
coreapi==2.3.3
psycopg2-binary==2.8.4
dj-database-url==0.5.0
gunicorn==20.0.4
whitenoise==5.0.1
PyYAML==5.4
azure-storage-blob==2.1.0
ptvsd==4.3.2
azure-common==1.1.23
azure-storage-common==2.1.0
requests==2.25.1
six==1.11.0
urllib3==1.26.3

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)