Helli,
I am trying to integrate dash app with flask app. Flask app is getting rendered and able to see html pages. But dash pages are not able tp be rendered and showing " Loading".
I am able to create plan dash app and its able to render. Some where while integrating the issues appears.
Error:
127.0.0.1 - - [27/Jul/2020 11:51:15] “GET /dashapp/dashapp/ HTTP/1.1” 200 -
127.0.0.1 - - [27/Jul/2020 11:51:15] “GET /_dash-component-suites/dash_renderer/polyfill@7.v1_2_3m1580483115.7.0.min.js HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 11:51:15] “GET /_dash-component-suites/dash_renderer/react@16.v1_2_3m1580483115.8.6.min.js HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 11:51:15] “GET /_dash-component-suites/dash_renderer/react-dom@16.v1_2_3m1580483115.8.6.min.js HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 11:51:15] “GET /_dash-component-suites/dash_renderer/prop-types@15.v1_2_3m1580483115.7.2.min.js HTTP/1.1” 404 -
127.0.0.1 - - [27/Jul/2020 11:51:15] “GET /_dash-component-suites/dash_html_components/dash_html_components.v1_0_2m1573845875.min.js HTTP/1.1” 404 -
Code : init.py
import os
from flask import Flask,render_template
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
import dash_table
import pandas as pd
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
flask_app = Flask(name,instance_relative_config=False)
basedir = os.path.abspath(os.path.dirname(file))
from mdapp.reports.prc_exec.views import exec_bp
@flask_app.route(’/home/’)
def home_page():
return render_template(“index.html”)
external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
dashapp = dash.Dash(name, external_stylesheets=external_stylesheets)
dashapp.css.config.serve_locally = True
dashapp.scripts.config.serve_locally = True
dashapp.layout = html.Div([
html.Button(id=‘submit-button’, n_clicks=0, children=‘Submit’),
html.Div(id=‘output-state’)
])
@dashapp.callback(Output(‘output-state’, ‘children’), [Input(‘submit-button’, ‘n_clicks’)],)
def print_yes(arg):
print(‘yes!’)
flask_app.register_blueprint(exec_bp,url_prefix="/execution")
app.py
from mdapp import flask_app,dashapp
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.serving import run_simple
app = DispatcherMiddleware(flask_app, {’/dashapp’: dashapp.server})
if name == “main”:
server.run(debug=True)
app.run_server(debug=True)
run_simple(‘0.0.0.0’, 5000,app, use_reloader=True, use_debugger=True)