Adding a favicon to a Flask server without HTML Adding a favicon to a Flask server without HTML python python

Adding a favicon to a Flask server without HTML


Put the icon in your static directory as favicon.ico. and below code in python file

import osfrom flask import send_from_directory@app.route('/favicon.ico')def favicon():    return send_from_directory(os.path.join(app.root_path, 'static'),                          'favicon.ico',mimetype='image/vnd.microsoft.icon')

href - http://flask.pocoo.org/docs/0.12/patterns/favicon/