I have an Django app that displays user uploaded images on the home page. I've used filepicker.io to handle the uploads, then store them in my Amazon S3 Bucket.
Problem is, when I try to serve them online, they aren't displaying correctly, b/c filepicker adds a unique key into the name of the file after uploading.
ie Uploaded file is called : milkshake.jpg.
after uploaded into S3 with filepicker, file is named : 97oj3Y12TIWylfhwlqtT_milkshake.jpg
An example file is hosted here: https://s3.amazonaws.com/mrt-static/97oj3Y12TIWylfhwlqtT_milkshake.jpg
When clicking on the image on the site, the URL it loads is this: https://s3.amazonaws.com/mrt-static/media/milkshake.jpg
How do I serve this on my site? Code below
#models.py
class Movie(models.Model):
poster = django_filepicker.models.FPFileField(upload_to='movie_poster')
#also, not uploading to the folder in the bucket (called movie_poster), just uploading into the bucket
#home.html
<img src = "{{ MEDIA_URL }}{{ movie.poster }}">
#settings.py
MEDIA_URL = 'https://s3.amazonaws.com/mrt-static/'