Answers for "how to send image to template thats not in static flask"

0

how to send image to template thats not in static flask

from config import directory_to_image_folder

#first create the route
@app.route('/uploads/<path:filename>')
def download_file(filename):
    return send_from_directory(directory_to_image_folder, filename, as_attachment=True)

#add this to the template inside of an image tag
<img width="100%" height="100%" src="{{ url_for('download_file', filename='name_of_image.extension') }}">
Posted by: Guest on August-07-2020

Code answers related to "how to send image to template thats not in static flask"

Python Answers by Framework

Browse Popular Code Answers by Language