vendredi 28 février 2020

Flask can not serve file accesed in javascript

I have a flask app:

app-|
    app.py
    templates-|
              index.html
    static-|
           main.js
           audio.mp3 

This is how I get the audio in main.js: audio = new Audio('audio.mp3');
but i get this Error: "GET /audio. mp3 HTTP/1.1" 404 - I tried all paths i could think of. Nothing worked.

If i try to get the file directly through the URL like ip\static\audio.mp3 it works. Also if i have all files in a folder and open the html document. What can i do to fix it? I could not find anything related to this. But im new to webdev so maybe i search the wrong termes




Aucun commentaire:

Enregistrer un commentaire