Я пытаюсь создать панель управления с библиотеками python dash
и plotly
. Я успешно создал панель инструментов stati c html, но когда я пытаюсь добавить график вместо простого html, я получаю 500 Internal Server Error
. Мой код выглядит следующим образом:
import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go
import numpy as np
app = dash.Dash()
# Creating data
np.random.seed(42)
random_x = np.random.randint(1, 100, 100)
random_y = np.random.randint(1, 100, 100)
data = [go.Trace(
x = random_x,
y = random_y,
mode = 'lines'
)]
layout = go.Layout(title = 'bello')
app.lyaout = html.Div([dcc.Graph(id = 'lineplot', figure = {'data': data, 'layout': layout})])
if __name__ == '__main__':
app.run_server()
Это выводит это, когда я пытаюсь получить доступ к веб-странице:
raise exceptions.NoLayoutException(
dash.exceptions.NoLayoutException: The layout was `None` at the time that `run_server` was called.
Make sure to set the `layout` attribute of your application
before running the server.
Любая помощь приветствуется!