Я пытаюсь построить график для моего шаблона django, но не могу этого сделать, получаю пустой шаблон.
views.py
#plotly libraries used
import plotly.graph_objects as go
import plotly.express as px
import plotly.offline as py
def home(request):
df=index(request) #returns a dataframe
#overall cases
total_df = df.groupby(['Country'])['Total Cases'].sum()
total_df = total_df.reset_index()
fig0 = px.scatter_geo(total_df,locations="Country", locationmode='country names',
color="Total Cases", size='Total Cases',hover_name="Country",
projection="orthographic",color_continuous_scale=px.colors.sequential.deep,
)
fig0 = go.Figure(data=fig0)
plot_div0 = py.plot(fig0, include_plotlyjs=False, output_type='div',config={'displayModeBar': False})
return render(request, 'test/welcome.html', {'plot_div0':plot_div0})
welcome. html
{{ plot_div0 | safe }}