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


Python util.getcwd方法代码示例

本文整理汇总了Python中gunicorn.util.getcwd方法的典型用法代码示例。如果您正苦于以下问题:Python util.getcwd方法的具体用法?Python util.getcwd怎么用?Python util.getcwd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gunicorn.util的用法示例。


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

示例1: __init__

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def __init__(self, app):
        os.environ["SERVER_SOFTWARE"] = SERVER_SOFTWARE

        self._num_workers = None
        self._last_logged_active_worker_count = None
        self.log = None

        self.setup(app)

        self.pidfile = None
        self.worker_age = 0
        self.reexec_pid = 0
        self.master_name = "Master"

        cwd = util.getcwd()

        args = sys.argv[:]
        args.insert(0, sys.executable)

        # init start context
        self.START_CTX = {
            "args": args,
            "cwd": cwd,
            0: sys.executable
        } 
开发者ID:RoseOu,项目名称:flasky,代码行数:27,代码来源:arbiter.py

示例2: init

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def init(self, parser, opts, args):
        if len(args) != 1:
            parser.error("No application name specified.")

        cwd = util.getcwd()
        cfgfname = os.path.normpath(os.path.join(cwd, args[0]))
        cfgfname = os.path.abspath(cfgfname)
        if not os.path.exists(cfgfname):
            parser.error("Config file not found: %s" % cfgfname)

        self.cfgurl = 'config:%s' % cfgfname
        self.relpath = os.path.dirname(cfgfname)
        self.cfgfname = cfgfname

        sys.path.insert(0, self.relpath)
        pkg_resources.working_set.add_entry(self.relpath)

        return self.app_config() 
开发者ID:RoseOu,项目名称:flasky,代码行数:20,代码来源:pasterapp.py

示例3: init

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def init(self, parser, opts, args):
        if opts.paste and opts.paste is not None:
            app_name = 'main'
            path = opts.paste
            if '#' in path:
                path, app_name = path.split('#')
            path = os.path.abspath(os.path.normpath(
                os.path.join(util.getcwd(), path)))

            if not os.path.exists(path):
                raise ConfigError("%r not found" % path)

            # paste application, load the config
            self.cfgurl = 'config:%s#%s' % (path, app_name)
            self.relpath = os.path.dirname(path)

            from .pasterapp import paste_config
            return paste_config(self.cfg, self.cfgurl, self.relpath)

        if len(args) < 1:
            parser.error("No application module specified.")

        self.cfg.set("default_proc_name", args[0])
        self.app_uri = args[0] 
开发者ID:RoseOu,项目名称:flasky,代码行数:26,代码来源:wsgiapp.py

示例4: make_default_env

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def make_default_env(cfg):
    if cfg.django_settings:
        os.environ['DJANGO_SETTINGS_MODULE'] = cfg.django_settings

    if cfg.pythonpath and cfg.pythonpath is not None:
        paths = cfg.pythonpath.split(",")
        for path in paths:
            pythonpath = os.path.abspath(cfg.pythonpath)
            if pythonpath not in sys.path:
                sys.path.insert(0, pythonpath)

    try:
        os.environ['DJANGO_SETTINGS_MODULE']
    except KeyError:
        # not settings env set, try to build one.
        cwd = util.getcwd()
        project_path, settings_name = find_settings_module(cwd)

        if not project_path:
            raise RuntimeError("django project not found")

        pythonpath, project_name = os.path.split(project_path)
        os.environ['DJANGO_SETTINGS_MODULE'] = "%s.%s" % (project_name,
                settings_name)
        if pythonpath not in sys.path:
            sys.path.insert(0, pythonpath)

        if project_path not in sys.path:
            sys.path.insert(0, project_path) 
开发者ID:RoseOu,项目名称:flasky,代码行数:31,代码来源:djangoapp.py

示例5: validate_chdir

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def validate_chdir(val):
    # valid if the value is a string
    val = validate_string(val)

    # transform relative paths
    path = os.path.abspath(os.path.normpath(os.path.join(util.getcwd(), val)))

    # test if the path exists
    if not os.path.exists(path):
        raise ConfigError("can't chdir to %r" % val)

    return path 
开发者ID:RoseOu,项目名称:flasky,代码行数:14,代码来源:config.py

示例6: get_default_config_file

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def get_default_config_file():
    config_path = os.path.join(os.path.abspath(os.getcwd()),
            'gunicorn.conf.py')
    if os.path.exists(config_path):
        return config_path
    return None 
开发者ID:RoseOu,项目名称:flasky,代码行数:8,代码来源:config.py

示例7: __init__

# 需要导入模块: from gunicorn import util [as 别名]
# 或者: from gunicorn.util import getcwd [as 别名]
def __init__(self, app):
        os.environ["SERVER_SOFTWARE"] = SERVER_SOFTWARE

        self._num_workers = None
        self._last_logged_active_worker_count = None
        self.log = None

        self.setup(app)

        self.pidfile = None
        self.systemd = False
        self.worker_age = 0
        self.reexec_pid = 0
        self.master_pid = 0
        self.master_name = "Master"

        cwd = util.getcwd()

        args = sys.argv[:]
        args.insert(0, sys.executable)

        # init start context
        self.START_CTX = {
            "args": args,
            "cwd": cwd,
            0: sys.executable
        } 
开发者ID:Agentscreech,项目名称:ShelbySearch,代码行数:29,代码来源:arbiter.py


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