I have a favicon.ico in my Flask app's html. The google bot wants to index it and of course it gets an error since I have it in my static folder and it has the /static/favicon.ico
code in my html as well. I didn't link it at all like /favicon.ico
.
66.249.64.15 - - [07/Jan/2023:11:50:58 +0000] "GET /favicon.ico HTTP/1.1" 301 289 "-" "Googlebot-Image/1.0" "66.249.64.15" response-time=0.001
66.249.64.11 - - [07/Jan/2023:11:50:58 +0000] "GET /favicon.ico/ HTTP/1.1" 500 291 "-" "Googlebot-Image/1.0" "66.249.64.11" response-time=0.025
66.249.64.13 - - [07/Jan/2023:11:50:59 +0000] "GET /favicon.ico/ HTTP/1.1" 500 291 "-" "Googlebot-Image/1.0" "66.249.64.13" response-time=0.011
My question is how should I handle this situation? I want to fix the above 500
error codes. My first idea would be something like this:
@app.route('/favicon.ico')
def static_from():
return send_from_directory(app.static_folder, request.path[1:])
Is this the correct solution? Or is there a better one?