I do not really understand how the database works when using in production. My stack:
- Django
- Heroku
- AWS S3
- PostgresSQL on Heroku
Users can generate some images on my app. The images are saved to AWS S3, and in some feature I want to retrieve the last generated image.
This below is my model where the images are saved in.
models.py:
class imgUploadModel(models.Model):
auto_increment_id = models.AutoField(primary_key=True, default=True)
image = models.ImageField(null=True, blank=True, upload_to="images/")
And here the view where the images is taken again and handled in some features.
view.py:
imgname = imgUploadModel.objects.all().last().image
As you can see I use .last() to get to the latest images which was generated.
Now to my questions:
In production, could it be that one user sees another users images? Or how does the Dynos (from heroku) separate the sessions? Since the AWS S3 bucket is just a memory storage without dividing it by users, I assume that one user can see other users images. Especially then, when user A creates an Img, and user B clicks on 'latest image'.
If it is so, how can I create Dynos or Buckets or anything else to prevent this behaviour. I just do not really understand it from a logical point of view.