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


Python wsgiapp.WSGIApplication方法代码示例

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


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

示例1: gunicorn_run

# 需要导入模块: from gunicorn.app import wsgiapp [as 别名]
# 或者: from gunicorn.app.wsgiapp import WSGIApplication [as 别名]
def gunicorn_run():
    """
    The ``gunicorn_pecan`` command for launching ``pecan`` applications
    """
    try:
        from gunicorn.app.wsgiapp import WSGIApplication
    except ImportError as exc:
        args = exc.args
        arg0 = args[0] if args else ''
        arg0 += ' (are you sure `gunicorn` is installed?)'
        exc.args = (arg0,) + args[1:]
        raise

    class PecanApplication(WSGIApplication):

        def init(self, parser, opts, args):
            if len(args) != 1:
                parser.error("No configuration file was specified.")

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

            from pecan.configuration import _runtime_conf, set_config
            set_config(self.cfgfname, overwrite=True)

            # If available, use the host and port from the pecan config file
            cfg = {}
            if _runtime_conf.get('server'):
                server = _runtime_conf['server']
                if hasattr(server, 'host') and hasattr(server, 'port'):
                    cfg['bind'] = '%s:%s' % (
                        server.host, server.port
                    )
            return cfg

        def load(self):
            from pecan.deploy import deploy
            return deploy(self.cfgfname)

    PecanApplication("%(prog)s [OPTIONS] config.py").run() 
开发者ID:openstack,项目名称:deb-python-pecan,代码行数:46,代码来源:serve.py

示例2: run

# 需要导入模块: from gunicorn.app import wsgiapp [as 别名]
# 或者: from gunicorn.app.wsgiapp import WSGIApplication [as 别名]
def run(self, *args, **kwargs):
        from gunicorn.app.wsgiapp import WSGIApplication

        app = WSGIApplication()

        app.app_uri = 'aardvark:create_app()'
        return app.run() 
开发者ID:Netflix-Skunkworks,项目名称:aardvark,代码行数:9,代码来源:manage.py

示例3: run_wsgi_app

# 需要导入模块: from gunicorn.app import wsgiapp [as 别名]
# 或者: from gunicorn.app.wsgiapp import WSGIApplication [as 别名]
def run_wsgi_app(address, app):
    try:
        from gunicorn.app.wsgiapp import WSGIApplication
        class GunicornApplication(WSGIApplication):
            def init(self, parser, opts, args):
                return {'bind': '%s:%d' % (address[0], int(address[1])),
                        'workers': 2,
                        'worker_class': 'gevent'}
            def load(self):
                return application
        GunicornApplication().run()
    except ImportError:
        from gevent.wsgi import WSGIServer
        WSGIServer(address, app).serve_forever() 
开发者ID:yuxiaokui,项目名称:Intranet-Penetration,代码行数:16,代码来源:index.py

示例4: run

# 需要导入模块: from gunicorn.app import wsgiapp [as 别名]
# 或者: from gunicorn.app.wsgiapp import WSGIApplication [as 别名]
def run():
    """\
    The ``gunicorn`` command line runner for launching Gunicorn with
    generic WSGI applications.
    """
    from gunicorn.app.wsgiapp import WSGIApplication
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() 
开发者ID:RoseOu,项目名称:flasky,代码行数:9,代码来源:wsgiapp.py


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