當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。