Hi. Please i need help with something here. Have been on it all day, I created a MULTIPAGE APP DASHBOARD and i have ran it via spyder on Anaconda Navigator. It does seem to work well. But my challenge is deploying it. But it gave me some errors:
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.
I would also paste my app.py file and index.pyfile for anyone to help me locate where the error might be.
#Required Libraries import dash import dash_bootstrap_components as dbc #https://bootswatch.com/# #Use of one of the dbc themes from bootswatch external_stylesheets = [dbc.themes.SKETCHY] # meta_tags are required for the app layout to be mobile responsive app = dash.Dash(__name__, external_stylesheets=external_stylesheets, suppress_callback_exceptions=True) #Running the app on the server server = app.server if __name__ == '__main__': app.run(debug=False)
from dash import dcc from dash import html from dash.dependencies import Input, Output # In[ ]: # Connect to main app.py file from app import app # Connect to your app pages from APPS import tc, sm, rc app.layout = html.Div([ dcc.Location(id='url', refresh=False), html.Div([ dcc.Link('Table Chart ', href='/APPS/tc'), dcc.Link('Revenue Across Shopping Malls ', href='/APPS/sm'), dcc.Link('Revenue Category ', href='/APPS/rc'), ], className="row"), html.Div(id='page-content') ]) @app.callback(Output('page-content', 'children'), [Input('url', 'pathname')]) def display_page(pathname): if pathname == '/APPS/tc': return tc.layout if pathname == '/APPS/sm': return sm.layout if pathname == '/APPS/rc': return rc.layout else: return "404 Page Error!" if __name__ == '__main__': app.run_server(debug=False)