How to stop flask application without using ctrl-c
If you are just running the server on your desktop, you can expose an endpoint to kill the server (read more at Shutdown The Simple Server): from flask import request def shutdown_server(): func = request.environ.get(‘werkzeug.server.shutdown’) if func is None: raise RuntimeError(‘Not running with the Werkzeug Server’) func() @app.get(‘/shutdown’) def shutdown(): shutdown_server() return ‘Server shutting down…’ … Read more