Django Media S3 - Model.get_queryset обращается к S3?
I have MEDIA files stored in S3
bucket and I noticed that REST API responses are very slow. What I also noticed is that Django
tries to access the S3
when I do Model.objects.all()
.
Why it does that? Doesn't it store the URL in the database so it doesn't have to access S3
storage unless the URL
is explicitly fetched (on the frontend side)?
DEFAULT_FILE_STORAGE = 'project.storage_backends.MediaStorage'
from storages.backends.s3boto3 import S3Boto3Storage
class MediaStorage(S3Boto3Storage):
location = 'media'
file_overwrite = False
Поле image
:
image = models.ImageField(upload_to='images', max_length=2048, null=True, blank=True, height_field='image_height',
width_field='image_width')
image_height = models.PositiveSmallIntegerField(null=True, blank=True)
image_width = models.PositiveSmallIntegerField(null=True, blank=True)