I had the same problem as shown in this question How to stop execution after some time?
and I tried the solution presented there for plotly, however it does not work for me since the piece of code is never reached. Any ideas why/ how to solve it? thanks.
After setting up the app.layout, i have the following code:
def shutdown():
func = request.environ.get('werkzeug.server.shutdown')
if func is None:
raise RuntimeError('Not running with the Werkzeug Server')
func()
@app.callback(dependencies.Output('page-content', 'children'), [dependencies.Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/shutdown':
print('I\'m here')
shutdown()
return html.Div([html.H3('You are on page {}'.format(pathname))])
if __name__ == '__main__':
app.title = "EOS Testing Dashboard"
app.run_server(debug=False)
It never prints "I'm here". I've tried to put "sys.exit()" after the last line but also that part is never reached.