Serving Static Files with Flask

Flask Tip - Static Files

Flask automatically creates a static endpoint to serve static files (like HTML templates, CSS stylesheets, JS files, and images).

For example, to serve an image, copy the image into the "static" folder of the Flask project. Create a new route and navigate to


from flask import current_app

def flask_logo():
    return current_app.send_static_file('flask-logo.png')