Hi, everybody
I have some troubles with callbacks in this app
I split my code to 5 files.
in first file my dash app
in second file my callbacks
in third file my layout
in fourth file my app configuration
in last - routing with navigation
when I choose /price callbacks don’t work. None of them!
What might be wrong with my code?
Also my import from file “callbacks” stands out gray (might be doesn’t work).
import dash
import dash_core_components as dcc
import dash_html_components as html
from flask import Flask, render_template
from app import app, flask_app
import callbacks
from layout import app as l1
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
dcc.Link('Navigate to "/price"', href='/price'),
html.Br(),
dcc.Link('Navigate to "/likvid"', href='/likvid'),
html.Div(id='page-content')
])
@app.callback(dash.dependencies.Output('page-content', 'children'),
[dash.dependencies.Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/likvid':
return '1'
elif pathname == '/price':
return l1.layout
else:
return 'wkhnwpo;ih;wvgi'
if __name__ == '__main__':
flask_app.run()