def main(): # Set reloader to False, bug present for imports # Retain this as FIXME # https://github.com/mitsuhiko/flask/issues/1246 reloader = False if cfg.is_debug: app.config['DEBUG'] = True uqpanel.add_debug_toolbar(app) if cfg.queues_for_reset_stats(): if job.check_connect_redis(): rq_worker.start_jobs() else: print("Error: There not connection to Redis") print(" Reset stats will not work\n") if cfg.base_url == '/': app.run(host=cfg.host_bind, port=cfg.port_bind, use_reloader=reloader, extra_files=[cfg.path_config_file]) else: application = DispatcherMiddleware(Flask('dummy_app'), { app.config['APPLICATION_ROOT']: app, }) run_simple(cfg.host_bind, cfg.port_bind, application, use_reloader=reloader, extra_files=[cfg.path_config_file])
def main(): # Set reloader to False, bug present for imports # Retain this as FIXME # https://github.com/mitsuhiko/flask/issues/1246 reloader = False if cfg.is_debug: app.config['DEBUG'] = True uqpanel.add_debug_toolbar(app) if cfg.queues_for_reset_stats(): if job.check_connect_redis(): rq_worker.start_jobs() else: print("Error: There not connection to Redis") print(" Reset stats will not work\n") if PY2: # This change is a fix for issue with Python 2.7 # The error is IOError: [Errno 32] Broken pipe # All this shit happend if the connection is closed early # by remove client (browser) # Long story https://github.com/pallets/werkzeug/issues/954 from gevent.wsgi import WSGIServer http_server = WSGIServer((cfg.host_bind, cfg.port_bind), app) http_server.serve_forever() if cfg.base_url == '/': app.run(host=cfg.host_bind, port=cfg.port_bind, use_reloader=reloader, extra_files=[cfg.path_config_file]) else: application = DispatcherMiddleware(Flask('dummy_app'), { app.config['APPLICATION_ROOT']: app, }) run_simple(cfg.host_bind, cfg.port_bind, application, use_reloader=reloader, extra_files=[cfg.path_config_file])