1

I have an Vuejs application running with Django framework, currently application running in production mode with static files are in local server, instead of serving files from location server want to keep in Azure storage

Followed below URL and made the changes to keep media and static files to azure

https://medium.com/@DawlysD/django-using-azure-blob-storage-to-handle-static-media-assets-from-scratch-90cbbc7d56be

Here is my setting.py in djando

STATICFILES_DIRS = [
     os.path.join(BASE_DIR, 'dist', 'static'),
 ]


# Added for Azure storage
STATICFILES_STORAGE ='storages.backends.azure_storage.AzureStorage'
DEFAULT_FILE_STORAGE = 'backend.custom_azure.AzureMediaStorage'
AZURE_ACCOUNT_NAME = os.environ['AZURE_ACCOUNT_NAME']
AZURE_ACCOUNT_KEY = os.environ['AZURE_ACCOUNT_KEY']
AZURE_CUSTOM_DOMAIN = f'{AZURE_ACCOUNT_NAME}.blob.core.windows.net'
STATIC_LOCATION = 'static'
STATIC_URL = f'https://{AZURE_CUSTOM_DOMAIN}/{STATIC_LOCATION}/'
AZURE_LOCATION = 'containertest04'
AZURE_CONTAINER = 'containertest04'
MEDIA_LOCATION = "media"
MEDIA_URL = f'https://{AZURE_CUSTOM_DOMAIN}/{MEDIA_LOCATION}/'

Facing 2 issues

1) Getting below error in django log while running "python3.7 manage.py collectstatic" also uploading files from my application

2020-01-04 14:50:59,888 azure.storage.common.storageclient INFO     Client-Request-ID=9e944449-2f01-11ea-9a8b-000d3a3be0ea Operation failed: checking if the operation should be retried. Current retry count=0, Server-Timestamp=Sat, 04 Jan 2020 14:50:59 GMT, Server-Request-ID=a1e7153a-401e-00df-690e-c38686000000, HTTP status code=404, Exception=The specified blob does not exist. ErrorCode: BlobNotFound.
2020-01-04 14:50:59,888 azure.storage.common.storageclient ERROR    Client-Request-ID=9e944449-2f01-11ea-9a8b-000d3a3be0ea Retry policy did not allow for a retry: Server-Timestamp=Sat, 04 Jan 2020 14:50:59 GMT, Server-Request-ID=a1e7153a-401e-00df-690e-c38686000000, HTTP status code=404, Exception=The specified blob does not exist. ErrorCode: BlobNotFound.

2) Both static and media files are going to the container containertest04, even though I have created separate container "static" and "media"

0 Answers0