def retrieve_asset ( filename ) : record = model . Image . get ( asset_name = filename ) if not record : raise http_error . NotFound ( "File not found" ) if not record . is_asset : raise http_error . Forbidden ( ) return flask . send_file ( record . file_path , conditional = True )
python flask imagwees show up as file not found
Retrieves a non - image asset associated with an entry
def retrieve_asset(filename):
    """ Retrieves a non-image asset associated with an entry """

    record = model.Image.get(asset_name=filename)
    if not record:
        raise http_error.NotFound("File not found")
    if not record.is_asset:
        raise http_error.Forbidden()

    return flask.send_file(record.file_path, conditional=True)