如果可能的话,我想在Jupyter Notebook上运行Flask,但是一旦应用程序运行起来,我就无法停止它,除非重启内核。有没有一种方法可以做一些等同于ctrl+c的事情来阻止应用程序在cell中运行?
下面是我正在做的事情:
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()
这会产生:
* 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 -
在Jupyter中,我无法中断内核,因此要停止应用程序的运行,我需要重新启动内核。有没有更好的方法?
https://stackoverflow.com/questions/54011462
复制相似问题