本文整理汇总了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)
示例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))
示例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))
示例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)
示例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)
示例6: run
# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def run(self):
conf = { '/': {}}
cherrypy.quickstart(self.__root, '/', conf)
示例7: main
# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def main():
"""Main."""
conf = {
"/": {
'request.dispatch': cherrypy.dispatch.MethodDispatcher()
}
}
cherrypy.quickstart(TuxyCaptcha(), "/", conf)
示例8: main
# 需要导入模块: import cherrypy [as 别名]
# 或者: from cherrypy import quickstart [as 别名]
def main():
"""Main."""
conf = {
"/": {
'tools.sessions.on': True,
}
}
cherrypy.quickstart(TuxyBot(), "/", conf)
示例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)
示例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)
示例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(), "/")
示例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), '/')
示例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)
示例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))
示例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))