当前位置: 首页>>代码示例>>Python>>正文


Python util.yellow函数代码示例

本文整理汇总了Python中realms.lib.util.yellow函数的典型用法代码示例。如果您正苦于以下问题:Python yellow函数的具体用法?Python yellow怎么用?Python yellow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了yellow函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start_server

def start_server():
    if is_running(get_pid()):
        yellow("Server is already running")
        return

    try:
        open(config.PIDFILE, 'w')
    except IOError:
        red("PID file not writeable (%s) " % config.PIDFILE)
        return

    flags = '--daemon --pid %s' % config.PIDFILE

    green("Server started. Port: %s" % config.PORT)

    config_path = config.get_path()
    if config_path:
        green("Using config: %s" % config_path)
    else:
        yellow("Using default configuration")

    prefix = ''
    if in_virtualenv():
        prefix = get_prefix() + "/bin/"

    Popen("%sgunicorn 'realms:create_app()' -b 0.0.0.0:%s -k gevent %s" %
          (prefix, config.PORT, flags), shell=True, executable='/bin/bash')
开发者ID:gazpachoking,项目名称:realms-wiki,代码行数:27,代码来源:commands.py

示例2: setup_upstart

def setup_upstart(**kwargs):
    """ Start upstart conf creation wizard
    """
    from realms.lib.util import upstart_script

    if in_virtualenv():
        app_dir = get_prefix()
        path = '/'.join(sys.executable.split('/')[:-1])
    else:
        # Assumed root install, not sure if this matters?
        app_dir = '/'
        path = None

    kwargs.update(dict(app_dir=app_dir, path=path))

    conf_file = '/etc/init/realms-wiki.conf'
    script = upstart_script(**kwargs)

    try:
        with open(conf_file, 'w') as f:
            f.write(script)
        green('Wrote file to %s' % conf_file)
    except IOError:
        with open('/tmp/realms-wiki.conf', 'w') as f:
            f.write(script)
        yellow("Wrote file to /tmp/realms-wiki.conf, to install type:")
        yellow("sudo mv /tmp/realms-wiki.conf /etc/init/realms-wiki.conf")

    click.echo()
    click.echo("Upstart usage:")
    green("sudo start realms-wiki")
    green("sudo stop realms-wiki")
    green("sudo restart realms-wiki")
    green("sudo status realms-wiki")
开发者ID:gazpachoking,项目名称:realms-wiki,代码行数:34,代码来源:commands.py

示例3: status

def status():
    """ Get server status
    """
    pid = get_pid()
    if not is_running(pid):
        yellow("Server is not running")
    else:
        green("Server is running PID: %s" % pid)
开发者ID:gazpachoking,项目名称:realms-wiki,代码行数:8,代码来源:commands.py

示例4: stop_server

def stop_server():
    pid = get_pid()
    if not is_running(pid):
        yellow("Server is not running")
    else:
        yellow("Shutting down server")
        call(['kill', pid])
        while is_running(pid):
            time.sleep(1)
开发者ID:gazpachoking,项目名称:realms-wiki,代码行数:9,代码来源:commands.py

示例5: dev

def dev(port, host):
    """ Run development server
    """
    green("Starting development server")

    config_path = config.get_path()
    if config_path:
        green("Using config: %s" % config_path)
    else:
        yellow("Using default configuration")

    app.run(host=host, port=port, debug=True)
开发者ID:scragg0x,项目名称:realms-wiki,代码行数:12,代码来源:commands.py

示例6: setup

def setup(ctx, **kw):
    """ Start setup wizard
    """

    try:
        os.mkdir('/etc/realms-wiki')
    except OSError:
        pass

    conf = {}

    for k, v in kw.items():
        conf[k.upper()] = v

    conf_path = config.update(conf)

    if conf['CACHE_TYPE'] == 'redis':
        prompt_and_invoke(ctx, setup_redis)
    elif conf['CACHE_TYPE'] == 'memcached':
        prompt_and_invoke(ctx, setup_memcached)

    if conf['SEARCH_TYPE'] == 'elasticsearch':
        prompt_and_invoke(ctx, setup_elasticsearch)
    elif conf['SEARCH_TYPE'] == 'whoosh':
        install_whoosh()

    green('Config saved to %s' % conf_path)

    if not conf_path.startswith('/etc/realms-wiki'):
        yellow('Note: You can move file to /etc/realms-wiki/realms-wiki.json')
        click.echo()

    yellow('Type "realms-wiki start" to start server')
    yellow('Type "realms-wiki dev" to start server in development mode')
    yellow('Full usage: realms-wiki --help')
开发者ID:gazpachoking,项目名称:realms-wiki,代码行数:35,代码来源:commands.py

示例7: start_server

def start_server():
    if is_running(get_pid()):
        yellow("Server is already running")
        return

    flags = '--daemon --pid %s' % config.PIDFILE

    green("Server started. Port: %s" % config.PORT)

    config_path = config.get_path()
    if config_path:
        green("Using config: %s" % config_path)
    else:
        yellow("Using default configuration")

    Popen("gunicorn 'realms:create_app()' -b 0.0.0.0:%s -k gevent %s" %
          (config.PORT, flags), shell=True, executable='/bin/bash')
开发者ID:Standfestgit,项目名称:realms-wiki,代码行数:17,代码来源:commands.py

示例8: create_user

def create_user(username, email, password):
    """ Create a new user
    """
    show_pass = not password

    if not password:
        password = random_string(12)

    if User.get_by_username(username):
        red("Username %s already exists" % username)
        return

    if User.get_by_email(email):
        red("Email %s already exists" % email)
        return

    User.create(username, email, password)
    green("User %s created" % username)

    if show_pass:
        yellow("Password: %s" % password)
开发者ID:scragg0x,项目名称:realms-wiki,代码行数:21,代码来源:commands.py

示例9: drop_db

def drop_db():
    """ Drops DB tables
    """
    yellow("Dropping all tables")
    with app.app_context():
        db.metadata.drop_all(db.get_engine(app))
开发者ID:gazpachoking,项目名称:realms-wiki,代码行数:6,代码来源:commands.py

示例10: clear_cache

def clear_cache():
    """ Clears cache
    """
    yellow("Clearing the cache")
    with app.app_context():
        cache.clear()
开发者ID:kyuanwei,项目名称:realms-wiki,代码行数:6,代码来源:commands.py


注:本文中的realms.lib.util.yellow函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。