javascript - Can't link js file to html file in flask template -


in project there folder named mine 2 subfolders (static folder & templates folder) , 1 app.py file init.

i have put jquery script file inside static folder , shop.html file in templates folder. want link html file js file.

i put inside html file:

<script type=text/javascript src="{{url_for('static', filename='/static/hide.js') }}"></script> 

but not work? problem?

you have duplicate 'static' in there:

url_for('static', filename='hide.js') 

the first 'static' automatically populate url points static folder, therefore putting 'static' in filename field redundant.

url_for('static', filename='static/hide.js') # '/static/static/hide.js'  url_for('static', filename='hide.js') # '/static/hide.js' 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -