python - How to shut-down built-in Flask server? -
whenever ran experimental flask server, used running on http://0.0.0.0:5000/ (press ctrl+c quit)
. indeed did quit whenever pressed ctrl + c. after ran threaded flask server, pressing ctrl + c closes server not exit process. must manually(painstakingly), kill process, jobs
determine process number kill
it, wait until terminated before restart server. wrong it? threaded servers behave way?
edit
do in application.py
.
from flask-sse import sse # code... app = flask(__name__) app.config["redis_url"] = "redis://localhost" app.register_blueprint(sse, url_prefix='/foo') # code again sse.publish() # want # code if __name__ == "__main__": app.run(threaded=true, host="0.0.0.0")
now run file python application.py
. no need flask run...
. says running on http://0.0.0.0:5000/ (press ctrl+c quit)
now try press ctrl + c. try reloading webpage, won't, implying server closed. @ terminal, process still hasn't terminated. if @ page /foo
, still seem getting events. doesn't stop. might imply thread hasn't stopped. painful effort kill process each time. there solution?
Comments
Post a Comment