Azure Storage Configuration
Before starting, you should have an Azure account to proceed with. For this tutorial we will be using Azure blob service which is an Object storage service. Other services are also available namely AWS S3 and Openstack Swift storage.
Creating Storage account and container
First thing first, create an storage account on Azure portal. Then you need to create a container on Azure portal. A container is equivalent to AWS S3 bucket. After configuring, you need to note three Azure keys (i.e AZURE_ACCOUNT_NAME, AZURE_ACCOUNT_KEY and AZURE_CONTAINER):
Once the storage account and container has been configured, it's time to modify some code in the edx-platform.
Code modification on edx-platform
For storing media and static files, Open Edx heavily relies on the django-storage package. This package consists of AzureStorage base backend class which needs to be inherited and will be called a derived backend class. Here we will be configuring Azure blob storage for profile pictures. The code modifications are as follows:
Add Azure keys to lms.env.json and lms.auth.json.
"AZURE_ACCOUNT_NAME": "openedx", "AZURE_ACCOUNT_KEY": "some_key", "AZURE_CONTAINER": "edxuploads", "DEFAULT_FILE_STORAGE": "openedx.core.storage.AzureStorageExtended",
Replace PROFILE_IMAGE_BACKEND, MEDIA_ROOT and MEDIA_URL on lms.env.json only.
"PROFILE_IMAGE_BACKEND": { "class": "openedx.core.storage.AzureStorageExtended", "options": { "container": "edxuploads", "url_expiry_secs": 500 } }, "MEDIA_ROOT": "https://openedx.blob.core.windows.net/edxuploads/", "MEDIA_URL": "https://openedx.blob.core.windows.net/edxuploads/",
Now, modify the files accordingly.
lms/djangoapps/instructor_task/models.py
lms/envs/aws.py
requirements/edx/base.txt (run pip install -r requirements/edx/base.txt)
openedx/core/djangoapps/user_api/accounts/image_helpers.py
openedx/core/storage.py b/openedx/core/storage.py
After modification, restart the Open Edx (LMS & CMS) and now you will be able to upload profile pictures in the profile section of LMS.