Hi,
I have a 4 pages app that I am now running using an index.py file (loosely similar to this ). I got access to a web server and reading around seems that the way to go would be use werkzeug. However after reading several examples on stackOverflow or this forum I cannot make it to work.
My project structure is something like this
assets\
data\
meta\
pages\
init.py
page1.py
page2.py
page3.py
home.py
app.py
index.py
wsgi.py
every pageX.py has both callbacks and layout and starts with
app = Dash(__name__,
url_base_pathname='/page1/',
external_stylesheets=external_stylesheets)
app.layout = dbc.Container(....)
while my wsgi.py file is structured like this. At the moment I tried both having an app within this file or by importing from pages.
import flask
from dash import Dash, html
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.serving import run_simple
from pages.page1 import app as page1
server = flask.Flask(__name__)
@server.route("/")
def home():
return "Hello, Flask!"
app2 = Dash(requests_pathname_prefix="/app2/")
app2.layout = html.Div("Hello, Dash app 2!")
application = DispatcherMiddleware(
server,
{"/page1": page1.server, "/app2": app2.server},
)
if __name__ == "__main__":
run_simple("localhost", 8050, application)
Problem is that while I can see localhost:8050/app2, when I go to localhost:8050/page1 it get stuck in the loading and outputs several 404 related to dash packages?
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET /page1 HTTP/1.1" 308 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET /page1/ HTTP/1.1" 200 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET /page1_dash-component-suites/dash/deps/polyfill@7.v2_3_1m1652107458.12.1.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/deps/react@16.v2_3_1m1652107458.14.0.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/deps/react-dom@16.v2_3_1m1652107458.14.0.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/deps/prop-types@15.v2_3_1m1652107458.7.2.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash_bootstrap_components/_components/dash_bootstrap_components.v1_1_0m1651876973.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_3_1m1652107458.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/dcc/dash_core_components.v2_3_0m1652107458.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/dcc/dash_core_components-shared.v2_3_0m1652107458.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/html/dash_html_components.v2_0_2m1652107458.min.js HTTP/1.1" 404 -
127.0.0.1 - - [13/Jun/2022 15:59:30] "GET //page1_dash-component-suites/dash/dash_table/bundle.v5_1_1m1652107458.js HTTP/1.1" 404 -
I tried both using request_url_prefix and also request_url_basename (raises 404 not found). What am I missing? Went through the docs but no information
Thanks!