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


Python cherrypy.quickstart方法代码示例

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


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

示例1: init

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def init(database_filename, host, port):
        """
        Configure and starts the server.

        :param database_filename:       Location of the database file.
        :param host:                    Address on which to listen.
        :param port:                    Port on which to listen.
        """
        cherrypy_cors.install()
        config = {
            '/': {
                'cors.expose.on': True,
                'tools.sessions.on': True,
                'tools.response_headers.on': True,
                'tools.response_headers.headers': [('Content-Type', 'text/plain')],
            },
        }
        cherrypy.config.update({
                'server.socket_host': host,
                'server.socket_port': port,
        })
        cherrypy.quickstart(Server(database_filename), "/api", config=config) 
开发者ID:nccgroup,项目名称:ScoutSuite,代码行数:24,代码来源:server.py

示例2: serve

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ('Your installation of Python does not have a profile module. '
               "If you're on Debian, try "
               '`sudo apt-get install python-profiler`. '
               'See http://www.cherrypy.org/wiki/ProfilingOnDebian '
               'for details.')
        warnings.warn(msg)

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(Profiler(path)) 
开发者ID:cherrypy,项目名称:cherrypy,代码行数:16,代码来源:profiler.py

示例3: serve

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError('The coverage module could not be imported.')
    from coverage import coverage
    cov = coverage(data_file=path)
    cov.load()

    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': 'production',
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
开发者ID:cherrypy,项目名称:cherrypy,代码行数:14,代码来源:covercp.py

示例4: browser_authorize

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def browser_authorize(self):
        """
        Open a browser to the authorization url and spool up a CherryPy
        server to accept the response
        """
        url, _ = self.oauth.authorize_token_url(redirect_uri=self.redirect_uri)
        # Open the web browser in a new thread for command-line browser support
        threading.Timer(1, webbrowser.open, args=(url,)).start()
        cherrypy.quickstart(self) 
开发者ID:praveendath92,项目名称:fitbit-googlefit,代码行数:11,代码来源:auth_fitbit.py

示例5: run

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def run():
    _c = sqlite3.connect(dbname)
    try:
        db.set_admins(_c, app_config["admins"])
        # user anonymity is achieved in the laziest possible way: a literal user
        # named anonymous. may god have mercy on my soul.
        db.anon = db.user_resolve(_c, "anonymous")
        if not db.anon:
            db.anon = db.user_register(
                _c, "anonymous",  # this is the hash for "anon"
                "5430eeed859cad61d925097ec4f53246"
                "1ccf1ab6b9802b09a313be1478a4d614")
    finally:
        _c.close()
    cherrypy.quickstart(API(), "/api", API_CONFIG) 
开发者ID:bbj-dev,项目名称:bbj,代码行数:17,代码来源:server.py

示例6: run

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def run(self):
        conf = { '/': {}}
        cherrypy.quickstart(self.__root, '/', conf) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:5,代码来源:httpproxy.py

示例7: main

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def main():
    """Main."""
    conf = {
        "/": {
            'request.dispatch': cherrypy.dispatch.MethodDispatcher()
        }
    }
    cherrypy.quickstart(TuxyCaptcha(), "/", conf) 
开发者ID:alexcoman,项目名称:labs,代码行数:10,代码来源:main.py

示例8: main

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def main():
    """Main."""
    conf = {
        "/": {
            'tools.sessions.on': True,
        }
    }
    cherrypy.quickstart(TuxyBot(), "/", conf) 
开发者ID:alexcoman,项目名称:labs,代码行数:10,代码来源:main.py

示例9: coudeploy

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def coudeploy():

	serverconf = os.path.join(os.path.dirname(__file__), 'server.conf')
	def error_404(status, message, traceback, version):
		return '''{"error":"not_found","reason":"no_db_file"}'''
	error_404.exposed = True

	cherrypy.config.update({'error_page.404':error_404})
	access_log = cherrypy.log.access_log
	cherrypy.quickstart(Couchpot(), config=serverconf) 
开发者ID:torque59,项目名称:nosqlpot,代码行数:12,代码来源:couchdeploy.py

示例10: main

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def main() :
    """
    cherrypy.root = QuillCherry()
    cherrypy.root.quillpad_backend = cherrypy.root
    cherrypy.config.update( file='quill_cherry8088.conf')
    cherrypy.config.update({'thread_pool': 10})
    cherrypy.server.start()
    """
    cherrypy._cpconfig.Config('quill_cherry8088.conf')
    quillCherry = QuillCherry()
    cherrypy.quickstart(quillCherry) 
开发者ID:teamtachyon,项目名称:Quillpad-Server,代码行数:13,代码来源:startquill_cherry.py

示例11: main

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def main():
    # Start web server
    cherrypy.config.update({"server.socket_host": "0.0.0.0", "server.socket_port": 80})
    cherrypy.quickstart(Root(), "/") 
开发者ID:mncoppola,项目名称:Linux-Kernel-CTF,代码行数:6,代码来源:server.py

示例12: web_main_thread

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def web_main_thread(sensors_data_storage):

    cherrypy.config.update({'environment': 'embedded',
                            'server.socket_port': 8089,
                            'engine.autoreload_on': False})

    th = threading.Thread(None, backfill_thread, "backfill_thread",
                          (sensors_data_storage,))
    th.daemon = True
    th.start()

    cherrypy.quickstart(WebWally(sensors_data_storage), '/') 
开发者ID:Mirantis,项目名称:disk_perf_test_tool,代码行数:14,代码来源:webui.py

示例13: run

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def run( self, args ):
       api =  RuntimeWebAPI()
       global_config = {
          "server.socket_host": args.host,
          "server.socket_port": int(args.port)
        } 
       my_config = {"/": {}}
       cherrypy.config.update(global_config)
       cherrypy.quickstart(api, "/", config=my_config) 
开发者ID:nadirhamid,项目名称:binner,代码行数:11,代码来源:runtime_web.py

示例14: serve

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def serve(path=None, port=8080):
    if profile is None or pstats is None:
        msg = ("Your installation of Python does not have a profile module. "
               "If you're on Debian, try "
               "`sudo apt-get install python-profiler`. "
               "See http://www.cherrypy.org/wiki/ProfilingOnDebian "
               "for details.")
        warnings.warn(msg)

    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': "production",
                            })
    cherrypy.quickstart(Profiler(path)) 
开发者ID:naparuba,项目名称:opsbro,代码行数:17,代码来源:profiler.py

示例15: serve

# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def serve(path=localFile, port=8080, root=None):
    if coverage is None:
        raise ImportError("The coverage module could not be imported.")
    from coverage import coverage
    cov = coverage(data_file=path)
    cov.load()

    import cherrypy
    cherrypy.config.update({'server.socket_port': int(port),
                            'server.thread_pool': 10,
                            'environment': "production",
                            })
    cherrypy.quickstart(CoverStats(cov, root)) 
开发者ID:naparuba,项目名称:opsbro,代码行数:15,代码来源:covercp.py


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