@dr_glenn wrote:
Another topic (Deploy Dash on apache server [solved!]) talks about the problem I am encountering, but ultimately does not give me enough information, so I’m starting a new topic.
I am forced to run CGI in Apache2 in Centos7 in a hosted VPS (virtual private server). I have root access. Not able to run WSGI.
dash==1.9.1
dash-core-components==1.8.1
dash-html-components==1.0.2
dash-renderer==1.2.4
dash-table==4.6.1I start my dash app from CGI (see below). The dash app code does this:
app = dash.Dash(__name__)The problem I see are failures like this:
GET http://<our_domain>/_dash-component-suites/dash_renderer/react@16.v1_2_2m1585338485.8.6.min.js net::ERR_ABORTED 404 (Not Found)
And the browser shows “Loading…” and nothing else.
From the previously referenced thread, I know that I need to start Dash with url_base_pathname, like this:
app = dash.Dash(__name__, url_base_pathname='/dash_test/')When I run with url_base_pathname, I get error in the browser: Not Found. The requested URL was not found on the server.
My key problem is that I don’t know where to put dash_test.py, hence don’t know the correct value for url_base_pathname. I think my problem would be solved if I only knew how to set url_base_pathname!
Since this is Apache CGI, I put dash_test.cgi into html/cgi-bin:
#!/home/jkhyrsmy/venv36/weather/bin/python # Python virtualenv must be activated activate_this = '/home/jkhyrsmy/venv36/weather/bin/activate_this.py' with open(activate_this) as f: code = compile(f.read(), activate_this, 'exec') exec(code, dict(__file__=activate_this)) from wsgiref.handlers import CGIHandler from dash_test import app CGIHandler().run(app.server)The CGI script is correct, I can use this script to instead load my “flask_test” and it works.
Here is the dash_test app:
# -*- coding: utf-8 -*- import dash import dash_core_components as dcc import dash_html_components as html app = dash.Dash(__name__, url_base_pathname='/dash_test/') server = app.server app.scripts.config.serve_locally = True app.css.config.serve_locally = True app.layout = html.Div(children=[ html.H1('Hello Dash'), ]) if __name__ == '__main__': app.run_server(debug=True, port=8050)dash_test.py is pretty simple, but I don’t know where to put it. Can I just drop it into html/cgi-bin? Should I instead make a subir, html/cgi-bin/dash_test and then put the Python Dash app in it with init.py? Should it be somewhere else and then I need to add another ScriptAlias to httpd.conf? Do I need to add ProxyPass directives in httpd.conf?
I have tried all of these things, but I just can’t get it to work. So I think I have these few questions:
Where should I put dash_test.py on my server?
What directives do I need in Apache httpd.conf?
What value do I need for Dash url_base_pathname?
Posts: 1
Participants: 1







