https://github.com/NVIDIA/DIGITS
Raw File
Tip revision: 5f9e132d53c8915c6c773e309f6d12900312e2b8 authored by Luke Yeager on 26 June 2015, 18:16:20 UTC
Mark v2.0.0-rc
Tip revision: 5f9e132
digits-devserver
#!/usr/bin/env python
# Copyright (c) 2014-2015, NVIDIA CORPORATION.  All rights reserved.

import sys
import argparse

# Only required if using SocketIO.run() and app.debug = False
from gevent import monkey; monkey.patch_all()

if __name__ == '__main__':
    print '  ___ ___ ___ ___ _____ ___'
    print ' |   \_ _/ __|_ _|_   _/ __|'
    print ' | |) | | (_ || |  | | \__ \\'
    print ' |___/___\___|___| |_| |___/'
    print

    parser = argparse.ArgumentParser(description='Run DIGITS in debug mode')
    parser.add_argument('-p', '--port',
            type=int,
            default=5000,
            help='Port to run app on (default 5000)'
            )
    parser.add_argument('-c', '--config',
            action='store_true',
            help='Edit the application configuration manually'
            )
    parser.add_argument('-d', '--debug',
            action='store_true',
            help='Run the application in debug mode (with the reloader)'
            )

    args = vars(parser.parse_args())

    from digits import config

    if args['config']:
        config.load_config('normal')
    else:
        config.load_config('quiet')

    from digits.webapp import app, socketio, scheduler

    try:
        if not scheduler.start():
            print 'ERROR: Scheduler would not start'
        else:
            app.debug = args['debug']
            socketio.run(app, '0.0.0.0', args['port'],
                    policy_server=False
                    )
    except KeyboardInterrupt:
        pass
    finally:
        scheduler.stop()

back to top