I have a Python Flask web app. Whenever I visit any of the endpoints via my chrome browser, a GET
request is invoked to retrieve the webpage (this is expected), but then, it appears Chrome sends a follow-up GET
request for a favicon.ico
to the same endpoint Chrome just hit.
For example, my app exoses the following endpoint at route /
(shown below):
# General Landing Page
@app.route('/')
def index():
return render_template("index.html", title="Home")
When I hit this endpoint with my Google Chrome, the index.html
page is returned just fine. But my log messages show the following:
env FLASK_APP=app/routes.py flask run --port 5001
* Running on http://127.0.0.1:5001/ (Press CTRL+C to quit)
127.0.0.1 - - [18/Feb/2020 23:15:23] "GET / HTTP/1.1" 200 -
[2020-02-18 23:15:23,647] ERROR in app: Exception on /favicon.ico [GET]
Traceback (most recent call last):
As you can see, the /
endpoint is hit and returns a status code of 200 OK
, but then a subsequent call to favicon.ico
errors out. How does one handle this?