Create a view that will generate the Plotly chart. In the view, you can
use the Plotly library to create a chart object and return it as an
HTML div string. Here is an example view:
from django.shortcuts import render
import plotly.graph_objs as go
import plotly.offline as opy
from django.http import HttpResponse
def my_chart(request):
trace1 = go.Bar(x=[1, 2, 3], y=[4, 5, 6])
data = [trace1]
layout = go.Layout(title='My Chart')
fig = go.Figure(data=data, layout=layout)
div = opy.plot(fig, auto_open=False, output_type='div')
return HttpResponse(div)