Im trying integrate dash app inside flask, and basically what I need to achieve now is get link to home page working inside dash app.
My code:
from flask import Flask, render_template, redirect
import dash
import dash_html_components as html
import dash_core_components as dcc
server = Flask(__name__)
@server.route('/')
def index():
return render_template('index.html')
@server.route('/login')
def login():
return render_template('login.html')
@server.route('/dashboard')
def dashboard():
return redirect('/dash')
app = dash.Dash(
__name__,
server=server,
routes_pathname_prefix='/dash/'
)
app.layout = html.Div([dcc.Link('Home', href='http://127.0.0.1:5000'),])
if __name__ == '__main__':
server.run(debug=True)
When I simply refresh page it returns to home page of flask, but I cant get it working with link click.
Any ideas how should do that? I understand that this is related to switch from Flask to Dash object, but I cant figure it out how to reverse it when I click link.