Ejemplo n.º 1
0
Archivo: app.py Proyecto: zerxis/qpanel
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])
Ejemplo n.º 2
0
Archivo: app.py Proyecto: pathcl/qpanel
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])
Ejemplo n.º 3
0
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])
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-

#
# Copyright (C) 2015-2020 Rodrigo Ramírez Norambuena <*****@*****.**>
#

from qpanel import config, job, rq_worker

if __name__ == '__main__':
    """
        Simple program to run worker for reset stats of Queue

        If you are running the QPanel using a uwsgi script should use
        this script to run background process will be reset stats for
        the queues

        see samples/resetstats_supervisor.conf
    """

    cfg = config.QPanelConfig()

    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")