title: Serving static files from static folder with Flask
body: <p>I am attempting to serve static mp3 files with Flask so I can embed these mp3 files in an HTML audio block. I seem to be having an issue setting up the path correctly but I am not entirely sure if my problem is in my python or html.</p>
  
  <p>An outline of my project:</p>
  
  <pre><code>music
      app.py
      static
          button.js
          MDF.mp3
      templates
          button.html
  </code></pre>
  
  <p>My app initialization in app.py looks like</p>
  
  <pre><code>app = Flask(__name__, static_url_path="", static_folder="static")
  </code></pre>
  
  <p>The route in app.py looks like</p>
  
  <pre><code>@app.route("/&lt;path:filename&gt;")
  def upload1():
      return send_static_file("MDF.mp3")
  </code></pre>
  
  <p>My default route:</p>
  
  <pre><code>@app.route("/", methods=["GET"])
  def home():
      return render_template("button.html", title="Music Box", name="MyName", song1=songList[0], song2=songList[1], song3=songList[2])
  </code></pre>
  
  <p>And my button.html looks like</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=en-US xml: lang"en-US"&gt;
  &lt;body&gt;
      &lt;o1&gt;
          &lt;li&gt; {{song1}}&lt;/li&gt;
          &lt;audio controls&gt;
              src=upload1():
              Your browser does not support the &lt;code&gt;audio&lt;/code&gt; element.
          &lt;/audio&gt;
          &lt;li&gt; {{song2}}&lt;/li&gt;
          &lt;audio controls&gt;
              src=upload2():
              Your browser does not support the &lt;code&gt;audio&lt;/code&gt; element.
          &lt;li&gt; {{song3}}&lt;/li&gt;
          &lt;audio controls&gt;
              src=upload3():
              Your browser does not support the &lt;code&gt;audio&lt;/code&gt; element.
      &lt;/ol&gt;
  
      &lt;script src="/static/button.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The error code I get is</p>
  
  <pre><code>10.245.81.226 - - [01/May/2019 04:25:08] "GET / HTTP/1.1" 404 -
  10.245.81.226 - - [01/May/2019 04:25:08] "GET /static/button.js HTTP/1.1" 404 -
  10.245.81.226 - - [01/May/2019 04:25:08] "GET /favicon.ico HTTP/1.1" 404 -
  </code></pre>