Aug-29-2020, 05:15 PM
So this might be a good time to look into Blueprints: https://flask.palletsprojects.com/en/1.1.x/blueprints/
Basically, you take all the related functionality, including static assets like images, bundle them together into a blueprint, and then bind that blueprint to a route. All your files would be in the same place on the filesystem, and would be grouped together logically in code.
The key benefit of having all your static assets in the same place, is so that when you move to deployment, flask isn't the server handling them anyway. Something like nginx or lighttpd handle the static folder, and flask is free to only respond to actual requests. The static assets probably don't change, so they can be heavily cached. But it doesn't sound like that's something you're concerned about yet :)
Basically, you take all the related functionality, including static assets like images, bundle them together into a blueprint, and then bind that blueprint to a route. All your files would be in the same place on the filesystem, and would be grouped together logically in code.
The key benefit of having all your static assets in the same place, is so that when you move to deployment, flask isn't the server handling them anyway. Something like nginx or lighttpd handle the static folder, and flask is free to only respond to actual requests. The static assets probably don't change, so they can be heavily cached. But it doesn't sound like that's something you're concerned about yet :)