Reputation:
You maybe know that I am making a discord.py bot. I’m using the flask library to keep alive my bot and to pack a website, for my bot. I want to add a favicon (favicon.ico) in my website, but I’m unable. I searched a lot in the documentation, my it didn’t worked. After, I watched a few YouTube tutorials, but it didn’t worked to. I don’t have any error, but, in the console, I always see this when I reload the page, to try another code. Can you help me please? And yes, I didn’t put codes, because I tried a lot of them.
Upvotes: 0
Views: 1289
Reputation: 360
You should put your favicon.ico in the static folder. The static folder is where you should have all your css and your favicon. If you currently don't have a static folder, create a folder called static
in your flask app's root folder, and add this
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
to your html's head tag.
Make sure you import url_for from flask with this from flask import url_for
.
This should do what you expect to do.
Upvotes: 0