If possible I would like to run Flask from a Jupyter Notebook but I can't stop the application once it's running without restarting the kernel. Is there a way to do something equivalent to ctrl+c to stop the app from running in cell?
Here is what I'm doing:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(['This is the outermost div',
html.Div(['This is an inner div'],
style=dict(color='red')),
html.Div(['Another inner div'],
style=dict(color='blue'))],
style=dict(color='green',
border='2px green solid'))
app.run_server()
Which yields:
* Serving Flask app "__main__" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
127.0.0.1 - - [02/Jan/2019 10:24:53] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [02/Jan/2019 10:24:54] "GET /_dash-layout HTTP/1.1" 200 -
127.0.0.1 - - [02/Jan/2019 10:24:54] "GET /_dash-dependencies HTTP/1.1" 200 -
127.0.0.1 - - [02/Jan/2019 10:24:54] "GET /_favicon.ico HTTP/1.1" 200 -
From Jupyter I'm unable to interrupt the kernel so to stop the app from running I need to restart the kernel. Is there a better way?