Search code examples
pythondatabase-connectionbottlerestartpeewee

Restart Bottle app (programmatically)


How do I restart my Bottle app programmatically?

def error_handler(error):
    if error.message == "connection already closed":
        RESTART_BOTTLE_SERVER()  # This will reacquire connection

Solution

  • You can stop the bottle app (thread) with the approach described in this answer.