If we want the graph just as an svg (you wont be able to print it) you have to add this code to de controller:

chart = bar_chart.render(is_unicode=True)

and in the template:

{{ chart|safe }}

But if you want to generate a PNG on the fly:

chart = b64encode(bar_chart.render_to_png()).decode('UTF-8')

and in the template:

<img src="data:image/png;base64,{{ chart|safe }}"/>