python – Adding a favicon to a Flask server without HTML

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 os
from 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/

python – Adding a favicon to a Flask server without HTML

Leave a Reply

Your email address will not be published.