this has weighed me down for a week now. seems like there’s no straight-forward solution anywhere, I’m really devastated.
I have hosted my python flask webapp and it’s postgres database successfully. Now I only need to link it with any cloud (not Google pls!) service that would enable the webapp to save images, and retrieve these images on request.
I plan to use redis for caching these images, greatly reducing the rate of requests sent to the cloud storage.
Please help!
2
Answers
when you talk about save or retrieve on cloud storage what kind of storage that you have in mind? because there’s few approach:
A. Store image / video as Binary
Using this approach it means all uploaded file or image will be written into db and all requested file will be read from db.
B. Store image / video as path
Using this approach it means if its local path then it all uploaded file will stored as local file in the server where the code is hosted.
if its remote path then it will stored on some cloud (Google Cloud Storage, AWS S3)
Also in your question you mention about redis as cache. I want to clarify some few things about redis. In approach A if you want to reduce query sent to db you can utilize redis to store binary of frequent accessed file, so on the next request it will be fetch from cache instead from db. In approach B redis doesn’t really reduce ‘requests sent to the cloud storage’ because client still fetch the file from cloud storage and your app just return where it stored. if you want to reduce no of request sent to cloud storage then maybe you looking about client-side cache or CDN.
You can save the image or video path into Redis db and retrieve them as well ,
Here is an example of save a video path into db and load them,