title: Adding a favicon to a Flask server without HTML
body: <p>My flask server constantly reports</p>
  
  <pre><code>xx.xxx.xxx.xxx - - [DD/MM/YYYY HH:MM:SS] "GET /favicon.ico HTTP/1.1" 404 -
  </code></pre>
  
  <p>In the code for my flask server I've added,</p>
  
  <pre><code>@app.route('/favicon.ico')
  def favicon():
      return send_from_directory(os.path.join(app.root_path, 'static'),'favicon.ico', mimetype='image/vnd.microsoft.icon')
  </code></pre>
  
  <p>and I've added a favicon titled <code>favicon.ico</code> to the same directory that my flask server is running from.</p>
  
  <p><a href="https://i.stack.imgur.com/FjaAE.png" rel="noreferrer">Favicon location</a></p>
  
  <p>If I try to navigate to <code>http://www.myurl.com/favicon.ico</code> I get a 404. My flask server isn't serving an html landing page so I can't add <code>&lt;link rel='shortcut icon' href='favicon.ico' type='image/x-icon'/ &gt;</code>  anywhere. I don't really care about actually having a favicon, I just want to stop the error from showing up. How can I serve a favicon/stop the error?</p>