Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

shutdown flask server with request

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.route('/shutdown', methods=['POST'])
def shutdown():
    shutdown_server()
    return 'Server shutting down...'
Source by web.archive.org #
 
PREVIOUS NEXT
Tagged: #shutdown #flask #server #request
ADD COMMENT
Topic
Name
8+2 =