[Chartjs]-Calling external Chartjs chart from a javascript file into HTML in Flask

1👍

Your html is template code that Flask translates into actual html.

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

Open the page in a browser and use “view source” to see the final html. The part inside the {{ }} will be replaced.

The actual html should look something like this.

<script src="/static/scripts.js"></script>

It’s likely that the generated src url is missing or incorrect, which means that your browser will not be able to load and execute the javascript file.

0👍

If the code runs fine in the HTML file, the issue must be with the path of the resource. Have you confirmed from the browser that the script.js file is being loaded?

Leave a comment