A few months ago, probably because of an Ubuntu and Uwsgi upgrade, our dash apps stopped working. Getting logs has been difficult but I think I’ve narrowed it down to the layout not loading, and the main module not working. Executing python runner.py works fine but not from uwsgi.
@chriddyp gave me the advice last year about handling multi apps, but I wonder if my runner.py is now out of date? Setup and code below
import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import sys from app import app # The name ("application") must match the "callable" in the uwsgi .ini file from app import server as application # Import the apps from the apps folder based on filename from apps import line, beehives, sr_by_over #from apps.bounce_graph import app as bounce_graph_app sys.path.insert(0, "/home/repos/blah/app") app.layout = html.Div([ dcc.Location(id='url', refresh=False), html.Div(id='page-content') ]) @app.callback(Output('page-content', 'children'), [Input('url', 'pathname')]) def display_page(pathname): if pathname == '/graph/line_graph': return line.layout elif pathname == '/graph/beehives': # Layouts must be served as a function to get fresh data. This needs # caching with DiskCache. layout = beehives.get_layout() return layout # elif pathname == '/graph/bounce_graph': # return bounce_graph_app.get_layout() elif pathname == '/graph/sr_by_over': return sr_by_over.layout else: return 'Loading ...' if __name__ == '__main__': app.run_server(debug=True)
My uwsgi.ini looks like this:
[uwsgi] master = true socket = 127.0.0.1:5569 processes = 4 threads = 1 thunder-lock = false chdir = /home/blah/repos/blah/app module = runner callable = application home = /home/blah/VirtualEnvs/blah limit-as = 1024 max-requests = 10000 harakiri = 360 vacuum = true touch-reload = /home/blah/uwsgi-reload/graph memory-report stats = /tmp/graph-stats.socket req-logger = file:/var/log/uwsgi/graph-access.log logger = file:/var/log/uwsgi/graph-error.log logformat = %(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"
Uwsgi usually just complains of
segmentation fault and it’s been impossible to diagnose further. But the layout not loading does seem to be the root cause. Can anyone spot anything wrong here? (Edit: versions etc below)
I know these are all out of date, but have tried upgrading them all which hasn’t helped.