I have a API based on Django REST working properly over Azure Web Service but it fails when trying to upload a file into the container's mount volume. I´m doing the upload process by a POST request and in my local environment it's works with no trouble.
The model I used to upload the file to the DB is this:
from app.controllers.users.models import User
class QueueJob(models.Model):
class Tasks(models.TextChoices):
COLLABORATORS_UPDATE = 'CB_UPDATE'
WITHDRAWALS_UPDATE = 'WD_UPDATE'
EXPATS_UPDATE = 'EP_UPDATE'
class Statuses(models.TextChoices):
PENDING = 'PENDING'
PROCESSING = 'PROCESSING'
DONE = 'DONE'
FAILED = 'FAILED'
user = models.ForeignKey(User, on_delete=models.CASCADE)
task = models.CharField(max_length=20, choices=Tasks.choices, blank=False, null=False)
file = models.FileField(upload_to=r'reports/', null=False)
extra_data = models.CharField(max_length=1024, blank=False, null=True)
execution_comment = models.CharField(max_length=255, blank=False, null=True)
status = models.CharField(max_length=20, choices=Statuses.choices, null=False, default=Statuses.PENDING)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
verbose_name = 'Queue Job'
verbose_name_plural = 'Queue Jobs'
ordering = ['created_at']
class QueueJobSerializer(ModelSerializer):
class Meta:
model = QueueJob
exclude = ['id', ]
The weird thing is that the file actualy loads up and I can access to it over the volume as you can see here but still failing when it runs the save() method when creating the DB record with the serializer returning the next error:
[Errno 1] Operation not permitted: '/app/storage/public/reports/report_UhrYWD6.xlsb'
I have tried installing django-storages for azure, but we are not using a Storage Account, just the volume mount, and also failed anyway.
I hope someone could help me