score:0

try removing <script></script> tag either from base.html or api_chart.html before and after jquery block. and also import chart.js and define id = "mychart" before using new chart.

<h1>hello world</h1>
    <canvas id="mychart" width="400" height="400"></canvas>
    <script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
    {% block jquery %}
        <script>
          var ctx = document.getelementbyid('mychart')
          var mychart = new chart(ctx, {
            type: 'bar',
            data: {
              labels: ['red', 'blue', 'yellow', 'green', 'purple', 'orange'],
              datasets: [{
                label: '# of votes',
                data: [12, 19, 3, 5, 2, 3],
                backgroundcolor: [
                .....
    {% endblock %}

Related Query

More Query from same tag