I have got the following folder structure
daemon.py
template.mako
html/
main.html
javascript/
script.js
Now my daemon is running a wsgi server, using bottle. The endpoint does the following:
@route("/main")
def main():
lookup = TemplateLookup(directories=["html", "html/javascript"])
return Template(filename="template.mako", lookup=lookup).render()
The mako template now includes the main.html (which contains the header) and does some looped function execution, rendering a card item from bulma for each turn of the loop. A button is supposed to be expanding the card via the script.js. The latter in turn is included via <script type="text/javascript" src="javascript/script.js"></script>
.
I've tried many different ways of providing the right path in src
and also moving the <script>
element from main.html to template.mako. The site itself is rendering just fine, correctly including the header. But besides the 200 for the site itself, I always get a 404 for the script upon loading the page.
Does anyone have an idea, what I am doing wrong?
You need endpoint to serve assets, ie. The JavaScript file. I would try opening the js file in the browser first. Here is their example: