Ask coding questions

← Back to all posts
Are you participating in our Music Hackathon?
katyadee (1127)

Are you making something? 🤔How's it going? What have the challenges been so far?

Commentshotnewtop
ryanlague (4)

Yes!
It is going very well except I have been monumentally stuck with a certain thing...

Using Flask, I seem to be unable to contain my JS in a separate file!
I have successfully contained my CSS in static files, but the JS just isn't being picked up!

Is this a known issue? I'm very new to JS and web stuff in general... It could very well be me!

I am trying to store my JS in:
/static/scripts/audio.js

and then use:

<script src="{{ url_for('static', filename='/scripts/audio.js') }}" </script>

Loading the page gives me no errors, I even get a 200:

172.18.0.1 - - [09/Jul/2019 02:12:03] "GET /root/runner/static/scripts/audio.js HTTP/1.1" 200 -

But then none of the functions work at all.
When I transfer all the JS into my index.html file, it works like a charm!
Thanks for hosting such an awesome competition!

ShadowCypher (29)

@ryanlague So I just discovered this post but it might be because you have a slash in front of scripts (so it should be <script src="{{ url_for('static', filename='scripts/audio.js') }}" </script>)

ebest (574)

Awful. I probably won't participate because all the Python music stuff doesn't work.

-Ebest

katyadee (1127)

@ebest There's way to make music repls without using python libraries that generate audio. But audio isn't required!