Hello,
I’m trying to load a layout if the path is http://127.0.0.1:8050/route1.
Unfortunately nothing happens in my app.
What am I doing wrong?
home.py:
import dash
from dash import html
from dash import dash_table
from dash import dcc
from dash.dependencies import Input, Output
import pandas as pd
import dash_home_url_app
app = dash.Dash(__name__)
app.config['suppress_callback_exceptions']=True
app.layout = html.Div([ dcc.Location(id="url"),
html.Div(id='page-content')
])
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
def display(pathname):
if pathname == 'route1':
return dash_home_url_app.layout
if __name__ == '__main__':
app.run_server(debug=True)
layout:
import dash
from dash import html
from dash import dash_table
from dash import dcc
from dash.dependencies import Input, Output
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
layout = dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict('records'),
),
thank you!