flask_manager
drunc.utils.flask_manager
Classes
FlaskManager(name, app, port, workers=1, host='0.0.0.0')
Bases: Thread
This class is a manager for flask. It allows to have a Flask server under a thread, start and stop it. Note that it creates another -trivial- endpoint accessible at the route /readystatus. This is used to poll if the service is up, however the user can provide it, and
To use this code, one can use the following example:
from flask_manager import FlaskManager manager = FlaskManager( port = port, app = app, name = "some-name" )
manager.start() while not manager.is_ready(): from time import sleep sleep(0.1)
Then, later on, to stop it: