Forums

Would using "Static Files" benefit me?

I'm trying to understand if I'd receive any benefit from using Static Files under the Web section for my Flask app.

It states:

Static files:
Files that aren't dynamically generated by your code, like CSS, JavaScript or uploaded files, can be served much faster straight off the disk if you specify them here. You need to Reload your web app to activate any changes you make to the mappings below.

I have around five page views that have a full screen background image, which I've managed to reduce to small sizes. Currently, the background images are just in the static/images directory of my Flask app for whichever route they are part of, so I guess served via Flask.

Would these background images still be considered served "straight off the disk" since they are hosted on PythonAnywhere?

Or would moving these to use the Static Files feature be better?

I don't quite understand the difference, appreciate any insight.

Thanks

It's recommended to use static files mappings due to performance benefits. On PythonAnywhere that needs an extra configuration step on the Web page of your web app -- see this help page for more details.