I’m trying to create a route on a flask website that is a dash app.
However the app doesn’t load and just says “Loading…” on my local host.
The plan is to deploy the flask website to an AWS elastic beanstalk.
The code is below:
from flask import Blueprint, flash, g, redirect, render_template, request, url_for, Flask
from werkzeug.exceptions import abort
from flaskr.auth import login_required
from flaskr.db import get_db
import os
import dash
import dash_renderer
import dash_core_components as dcc
import dash_html_components as html
server = Flask(__name__)
dash_app = dash.Dash(__name__, server=server, url_base_pathname='/')
dash_app.config.suppress_callback_exceptions = True
dash_app.scripts.config.serve_locally = True
dash_app.layout = html.Div('Hello World')
bp = Blueprint('dashboards', __name__, url_prefix='/dashboards')
@bp.route('/select', methods=['GET', 'POST'])
def index():
return render_template('dashboards/select.html')
@bp.route('/dash_one', methods=['GET', 'POST'])
def dash_one():
return dash_app.index()
Here’s what happens when I load the page:
I get “GET /_dash-component-suites/dash_renderer/bundle.js?v=0.12.1 HTTP/1.1” 404 (amongst others as you can see). I am not sure why it can’t find my dash sitepackage?
The url_base_pathname is the “/” before the “_dash-component-suites”
The file structure is below:
It’s pretty much file structure from the flask tutorial.
I want it to load obviously but I don’t know where/what “/_dash-component-suites/” is and how to get the flask website to GET them?
NB: If I comment-out ‘dash_app.scripts.config.serve_locally = True’ I get this error instead (with url_base_pathname=’/dummypath/’):
127.0.0.1 - - [28/May/2018 16:43:44] “GET /dashboards/dash HTTP/1.1” 200 -
127.0.0.1 - - [28/May/2018 16:43:44] “GET /dummypath/_dash-layout HTTP/1.1” 404 -
127.0.0.1 - - [28/May/2018 16:43:44] “GET /dummypath/_dash-dependencies HTTP/1.1” 404 -
Any help is appreciated.