How to integrate dash app within flask? I have included my file structure and some of the codes for your reference and my help

image

image

I think the template and static files are not necessary for clearing my doubts.

When I run this app in the cmd prompt, I get the following output and can’t see anything on the localhost:

dashapp.py

from plotlydash import create_app

server = create_app()

config.py(root directory)

import os
basedir = os.path.abspath(os.path.dirname(__file__))


class BaseConfig:
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SECRET_KEY = os.environ['SECRET_KEY']

wsgi.py:

from plotlydash import create_app

app = create_app()

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True)

plotlydash_init_.py:

import dash
from flask import Flask


from config import BaseConfig

def create_app():
    server = Flask(__name__)
    server.config.from_object(BaseConfig)

    register_dashapps(server)
    register_extensions(server)
    register_blueprints(server)

    return server


def register_dashapps(plotlydash):
    from plotlydash.apps import layout
    from plotlydash.apps.callbacks import register_callbacks

    # Meta tags for viewport responsiveness
    meta_viewport = {"name": "viewport", "content": "width=device-width, initial-scale=1, shrink-to-fit=no"}

    dashapp1 = dash.Dash(__name__,server=app,url_base_pathname='/dashboard/',meta_tags=[meta_viewport])

    with plotlydash.app_context():
        dashapp1.title = 'Dashapp 1'
        dashapp1.layout = layout
        register_callbacks(dashapp1)

I have made a separate apps subfolder for my dash app.