I'm trying to display a javascript file in a python flask project. I'm using blocks in the html file which is calling the javascript file. It is just not displaying on the webpage.
If I remove the base.html part of the project and just put everything into the snake.html file it runs fine, which says to me the Javascript is fine, I'm just misunderstanding the Flask parts.
Any assistance you could give me, would be greatly appreciated.
base.html
<html>
<head>
{% if title %}
<title>{{ title }}</title>
{% else %}
<title>Unseen Arcade</title>
{% endif %}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style> body {padding: 10; margin: 10;} </style>
<script src="p5.min.js"></script>
<script src="addons/p5.dom.min.js"></script>
<script src="addons/p5.sound.min.js"></script>
{% block scripts %}{% endblock scripts %}
</head>
<body>
<div>Unseen Arcade: <a href="/index">Home</a></div>
<hr>
{% block content %}{% endblock content %}
</body>
</html>
snake.html
{% extends "base.html" %}
{% block scripts %}
<script src="{{url_for('static', filename='snake/snake.js')}}"></script>
{% endblock %}
{% block content %}
<body>
<h2> Snake Game:</h2>
<p>Use the keys W, A, S, and D to control the direction of the snake, if you get onto the leaderboard with a score above 50 you will receive a hint on the locations of other secret arcades in London.$
</body>
{% endblock %}
folder layout:
FlaskApp/
FlaskApp/
forms.py
__init__.py
routes.py
static/
p5.min.js
addons/
p5.dom.min.js
p5.sound.min.js
snake/
snake.js
templates/
base.html
snake/
snake.html
flaskapp.wsgi