Python Forum
Flask, Display a picture outisde the static
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask, Display a picture outisde the static
#7
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 :)
Reply


Messages In This Thread
RE: Flask, Display a picture outisde the static - by nilamo - Aug-29-2020, 05:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Solved] Private static files SpongeB0B 1 1,625 Jul-16-2022, 05:36 AM
Last Post: SpongeB0B
  SHow image in a static link of Django pycada 3 3,414 Mar-04-2020, 01:50 AM
Last Post: pycada
  display multiple sensors on webpage python flask jinja pascale 6 6,641 Jan-29-2019, 10:10 AM
Last Post: pascale
  flask requests display data from api on webpage with javacript pascale 0 3,259 Oct-25-2018, 08:30 PM
Last Post: pascale
  Django loading static files Dutchpy 7 25,822 Oct-13-2017, 10:25 AM
Last Post: hbknjr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020