def handle(self, *args, **options):
        self.check_migrations()
        app = make_app(debug=True)

        app.listen(options['port'])
        self.stdout.write('Listen on http://127.0.0.1:' + str(options['port']))

        try:
            IOLoop.current().start()
        except KeyboardInterrupt:
            pass
Ejemplo n.º 2
0
    pass


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print '=> You can pass --help to see help of manager <='
    elif '--help' in sys.argv:
        print 'Help: exist functions'
        i = 1
        for func_name in functions:
            print '{index}. {func_name}'.format(index=i, func_name=func_name)
            i += 1
    elif sys.argv[1] not in functions:
        print 'Error:=> calling function irregular!!! call command with --help \n'
    else:
        app = make_app(Config)
        func_name = sys.argv[1]
        if func_name == 'routes':
            print '===>Call routes function:<==='
            routes(app)
        elif func_name == 'create_db':
            print '===>Call create_db function:<==='
            create_db(app)
        elif func_name == 'create_schema':
            print '===>Call create_schema function:<==='
            create_schema(app)
        elif func_name == 'drop_db':
            print '===>Call drop_db function:<==='
            drop_db(app)
        elif func_name == 'populate_db':
            print '===>Call populate_db function:<==='