Serving static files through a static service for a web service?

I have a flask backend service with a fairly hefty amount of files (mostly images), and was wondering if my page would load any faster if the frontend fetched them from a static service as opposed to flask serving them? I would rather avoid the work of setting up my own cdn to serve the images. In the case that it would speed up load times, could this also potentially lower bandwidth usage across my account?

Hey,

if the frontend fetched them from a static service as opposed to flask serving them

What do you mean by that?

Where are you serving those images from? From the backend itself? Where are they stored? On Render? On a Disk?

Jérémy.
Render Support, UTC+3

All the images are literally just stored ins GitHub repo right now and my flask web app is serving them as another endpoint from its file system. My idea would be to link the same GitHub repo or similar to give a static service access to those images. I would then have my front end fetch from the static service instead of from flask

I wouldn’t recommend hosting and storing images directly on your static sites, except for small ones like icons and logos. For larger images, you should use an external storage service. Otherwise, your site’s download size will balloon, making your static files bulkier and slower to load in a browser. Everything on a static site needs to be bundled together before it can be served to the browser. You can’t access the filesystem directly from a static site because it operates within the browser’s environment.

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.