Пример #1
0
def main():
    parser = argparse.ArgumentParser(
        prog='june',
        description='June: a forum',
    )
    parser.add_argument('command', nargs="*")
    parser.add_argument('-f', '--config', dest='config')
    args = parser.parse_args()

    if args.config:
        parse_config_file(args.config)  # config
    else:
        return init_project()

    def run_command(cmd):
        if cmd == 'createdb':
            return create_db()
        if cmd == 'createuser':
            return create_superuser()
        if cmd == 'init':
            return init_project()

    if isinstance(args.command, basestring):
        return run_command(args.command)
    if isinstance(args.command, (list, tuple)):
        for cmd in args.command:
            run_command(cmd)
Пример #2
0
Файл: app.py Проект: mitnk/june
def run_server():
    define('settings', '')
    tornado.options.parse_command_line()
    parse_config_file(options.settings)
    server = HTTPServer(Application(), xheaders=True)
    server.listen(int(options.port))
    IOLoop.instance().start()
Пример #3
0
def run_server():
    define('config', '')
    define('port', '8000')
    tornado.options.parse_command_line()
    parse_config_file(options.config)
    server = HTTPServer(Application(), xheaders=True)
    server.bind(int(options.port))
    server.start(int(options.num_processes))
    IOLoop.instance().start()