Set the site favicon (Flask)

Asked

Viewed 73 times

0

I want to know how that puts the icon of the site, I have the icon saved on static / favicon.ico, but in the template when I try to reference, n comes to nothing, it’s as if the code n existed, I’ve tried everything from flask documentation but comes to nothing (no error in browser console or python)

Edit: I’ve tried to leave it in the same template and . py file, nothing was

  • If that answers your question https://answall.com/questions/304704/%C3%8Dcone-do-site-no-shortcut-to-add-site-to-a-screen-do-celular-na-op%C3%A7%C3%A3o-que-o/304708#304708

1 answer

0


You must put the tag in your html to define it, if your icon is served as a static file by Flask, inside the tag <head> would be more or less the following:

<link rel="shortcut icon" type="image/png" href="{{ url_for('static', filename='favicon.ico') }}"/>

If not, try restarting the service or removing the page cache from your browser.

  • I tried that, but it didn’t work

  • Strange, I did the above example in a test before posting and it worked. Which version of flask are you using? You have cleared the browser cache/restarted your flask service as recommended?

  • version is 1.0.3, and yes

  • Is your flask running in debug mode? If you’re not sure, try running export FLASK_ENV=development (if you are in windows, change export for set) and then, flask run to start the service. Maybe this helps you to see some error message, which is preventing the execution of your routine. Not to mention that the "hot Reload" of your Flask service whenever there are changes to your code will only be active in debug mode.

  • Nothing’s come up, just this: 127.0.0.1 - - [20/May/2019 18:54:11] "GET / HTTP/1.1" 200 -

  • left, worked, was the opera

  • Haha, I was going to say test it on other browsers. I’m glad you decided.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.