Flask basics: lose the favicon 404

A quick way to get rid of the 404 error caused by the favicon being missing.

If the fact that the Flask development server cant find your favicon annoys you shove your favicon into your static folder and do this:

@app.route("/favicon.ico")
def favicon():
    return(url_for('static',filename='favicon.ico')

NOTE: this is one of several ways of getting rid of that particular error and is the one I'm using today. I'll add more as I use them.

Comments powered by Talkyard.