I'm following this tutorial to add a progress bar when I'm uploading a file in Django, using ajax. When I'm uploading the file to a folder using the upload_to
option everything works fine. But when I'm uploading the file to Azure using the storage
option - It doesn't work. i.e. when this is my model:
class UploadFile(models.Model):
title = models.CharField(max_length=50)
file=models.FileField(upload_to='files/media/pre')
It works perfect, but when this is my model:
from myAzure import AzureMediaStorage as AMS
class UploadFile(models.Model):
title = models.CharField(max_length=50)
file = models.FileField(storage=AMS)
It gets stuck and not progressing. (AMS is defined in myAzure.py by):
from storages.backends.azure_storage import AzureStorage
class AzureMediaStorage(AzureStorage):
account_name = '<myAccountName>'
account_key = '<myAccountKey>'
azure_container = 'media'
expiration_secs = None
How can I make it work?
EDIT: If it was not clear:
- my problem is not to upload to Azure, but to show progress bar.
- From security reasons I do not want to upload the file from the browser and to use CORS and SAS but from my backend.
from Django - upload a file to the cloud (Azure blob storage) with progress bar
No comments:
Post a Comment