From f7aebd890a11e233202a656bb6e568ed494c9d2c Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Wed, 27 Mar 2024 02:36:05 +1100 Subject: [PATCH] [docs/azure] Explain how to use with Azurite (#1371) --- docs/backends/azure.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/backends/azure.rst b/docs/backends/azure.rst index 58ba92e2..00d6fa99 100644 --- a/docs/backends/azure.rst +++ b/docs/backends/azure.rst @@ -147,6 +147,33 @@ Settings The api version to use. +Using with Azurite (previously Azure Storage Emulator) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Azurite is a local emulator for Azure Storage accounts that emulates the API for Azure Blob storage and enables local testing and development without an Azure account, free of charge. + +To use the Azure Storage Emulator, you download and install it from the `Azurite page `_. + +Copy the default `connection string `_ and set it in your settings:: + + STORAGES = { + "default": { + "BACKEND": "storages.backends.azure_storage.AzureStorage", + "OPTIONS": { + "connection_string": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;", + "azure_container": "media", + }, + }, + "staticfiles": { + "BACKEND": "storages.backends.azure_storage.AzureStorage", + "OPTIONS": { + "connection_string": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;", + "azure_container": "static", + }, + }, + } + +Django Storages will not create containers if they don't exist, so you will need to create any storage containers using the Azurite CLI or the Azure Storage Explorer. Additional Notes ----------------