コード例 #1
0
def main():
    """
    Start eMonitor application

    :argument:
        -   -t --tornado: use tornado webserver
        -   -b --builtin: use flask webserver (only for test)
        -   -p --port: define port for webserver
        -   -d: start in debug mode
    """
    parser = argparse.ArgumentParser()
    parser.add_argument('-b', '--builtin', help='use builtin flask webserver', default=None, action='store_true')
    parser.add_argument('-c', '--cherrypy', help='use cherrypy webserver', default=None, action='store_true')
    port = app.config.get('PORT')
    parser.add_argument('-p', '--port', help='run webserver on port (default: 8080)', type=int, default=port)
    parser.add_argument('-d', help='debug mode without restart', default=None)

    args = vars(parser.parse_args())

    if 'port' in args:  # use port from command line
        app.config['PORT'] = args['port']
    if not args['builtin'] and not args['cherrypy']:
        from emonitor.webserver import webserver
        webserver(app)
    elif args['builtin']:
        builtin(args)
コード例 #2
0
def main():
    """
    Start eMonitor application

    :argument:
        -p --port: define port for webserver
        -f --configfile: use given config file, default: emonitor.cfg
        --debug  : start in debug mode
    """
    global args
    from emonitor import app
    from emonitor.webserver import webserver
    if args.get('port'):
        app.config.update({'PORT': args.get('port')})
    if args.get('debug'):
        app.config.update({'DEBUG': True})
    webserver(app)
コード例 #3
0
ファイル: run.py プロジェクト: GroSte/eMonitor
def main():
    """
    Start eMonitor application

    :argument:
        -   -b --builtin: use flask webserver (only for test)
        -   -c --cherrypy: use cherrypy webserver
        -   -p --port: define port for webserver
        -   -d: start in debug mode
    """
    parser = argparse.ArgumentParser()
    parser.add_argument('-b',
                        '--builtin',
                        help='use builtin flask webserver',
                        default=None,
                        action='store_true')
    parser.add_argument('-c',
                        '--cherrypy',
                        help='use cherrypy webserver',
                        default=None,
                        action='store_true')
    port = app.config.get('PORT')
    parser.add_argument('-p',
                        '--port',
                        help='run webserver on port (default: 8080)',
                        type=int,
                        default=port)
    parser.add_argument('-d',
                        help='debug mode without restart',
                        default=None,
                        action='store_true')

    args = vars(parser.parse_args())

    app.config['HOST'] = '0.0.0.0'
    if 'port' in args:  # use port from command line
        app.config['PORT'] = args['port']
    if not args['builtin'] and not args['cherrypy']:
        from emonitor.webserver import webserver
        webserver(app)
    elif args['builtin']:
        builtin(args)
コード例 #4
0
 def SvcDoRun(self):
     app.config['service'] = True  # activate service configuration
     webserver(app)
     win32event.WaitForSingleObject(self.stop_event, win32event.INFINITE)