Skip to content

Commit 263c0a1

Browse files
Merge pull request #1517 from IFRCGo/fix/azure-storage-read
Fix azure file read/open issue.
2 parents 29314de + e7f8e7c commit 263c0a1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

api/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _open(self, name, mode='rb'):
7373
blob_name=name
7474
)
7575

76-
return ContentFile(contents)
76+
return ContentFile(contents.content)
7777

7878
def _save(self, name, content):
7979
"""

main/settings.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,17 @@
338338
'USE_SSL': False,
339339
}
340340
if AZURE_STORAGE_ACCOUNT:
341-
# FIXME: Use https://django-storages.readthedocs.io/en/latest/backends/azure.html instead.
342341
DEFAULT_FILE_STORAGE = 'api.storage.AzureStorage'
343342

343+
"""
344+
# FIXME: TODO: Use this instead. https://django-storages.readthedocs.io/en/latest/backends/azure.html
345+
AZURE_ACCOUNT_NAME = env('AZURE_STORAGE_ACCOUNT')
346+
AZURE_ACCOUNT_KEY = env('AZURE_STORAGE_KEY')
347+
AZURE_CONTAINER = 'api'
348+
if AZURE_STORAGE_ACCOUNT:
349+
DEFAULT_FILE_STORAGE = 'storages.backends.azure_storage.AzureStorage'
350+
"""
351+
344352
# Email config
345353
EMAIL_API_ENDPOINT = env('EMAIL_API_ENDPOINT')
346354
EMAIL_HOST = env('EMAIL_HOST')

0 commit comments

Comments
 (0)