def deinitialize_manager(): """Do any cleanup that needs to be done (for backends in particular) before the server terminates. """ log.info("Shutting down server...") views.manager.shutdown()
def start_server(custom_config, debug=True): """Start the flask Server using flask's built in Werkzeug server. This function doesn't return. """ app.config = translate.utils.update(app.config, custom_config) server_conf = app.config['SERVER'] host = server_conf['host'] port = server_conf['port'] log.info("Starting server on port {0}, using host {1}".format(port, host)) # Extra, optional arguments to be passed as kwargs. options = {} if server_conf['ssl']['enabled']: log.info('Using SSL') options['ssl_context'] = (server_conf['ssl']['cert'], server_conf['ssl']['key']) app.run(host=host, port=port, debug=debug, **options)