Hi,
I’m stuck. I am trying to setup a dash app using Apache 2.4, Flask, and mod_wsgi. I was able to get it to work fine in the root directory, but could not get it to work in a subdirectory. It works when I set this in apache’s configuration:
WSGIScriptAlias / /var/www/hello/hello.wsgi/
but if instead I do
WSGIScriptAlias /hello /var/www/hello/hello.wsgi/
then I get the “Error loading layout” message. I checked other posts in this forum, and it seemed a problem of setting url_base_pathname, so I changed it to url_base_pathname=‘/hello/’ and then I got a 404 error. It beats me.
In other words: Apache is serving the app as expected (at my.domain.com/hello) if I do not modify url_base_pathname, but in this case dash looks for _dash-dependencies and _dash-layout in the wrong place (I verified that this is the case in Apache’s logs). If I do modify url_base_pathname, then I get the 404 error. How is this happening? Does someone know?
For reference:
Ubuntu bionic 18.04 LTS
Apache configuration:
WSGIDaemonProcess hello user=ubuntu group=ubuntu python-home=/home/ubuntu/hello/env python-path=/home/ubuntu/hello
WSGIProcessGroup hello
WSGIScriptAlias / /var/www/hello/hello.wsgi/
<Directory /var/www/hello>
<Files hello.wsgi>
Require all granted
</Files>
</Directory>
hello.py
from flask import Flask
app = Flask(__name__)
import dash
import dash_html_components as html
dash_app = dash.Dash(__name__,
server=app)
dash_app.layout = html.Div([
html.H2('Hello World'),
])
hello.wsgi
from hello import app as application
requirements.txt
dash==0.28.2
dash-core-components==0.33.0
dash-html-components==0.13.2
dash-renderer==0.14.1
Flask==1.0.2
Flask-Compress==1.4.0
plotly==3.3.0