Reputation: 15
I am new to web programming and I have the following issue.
So I am trying to set up a small server on Jupyter notebook. The issue right now is when I do
<script src="../src/main.js">
in my HTML, it cannot find the corresponding JS file. I tried http://localhost:8888/src/main.js
as the path but this does not work either as it is forbidden.
I am wondering is there any way to work around this?
Thanks
EDIT: the project structure is similar to the following
/
server.py
src/
main.js
templates/
main.html
server.py
is a flask application that can render the main.html
.
Upvotes: 0
Views: 194
Reputation: 106
to include the static files in the flask first you need to follow the folder structure
I have attached the link below for your reference Here
and answering your question
move the js file to a static/ subdirectory
url_for('static', filename='path/to/file')
in your HTML file
you can find more details here
Upvotes: 1