本文整理汇总了Python中bottle.debug方法的典型用法代码示例。如果您正苦于以下问题:Python bottle.debug方法的具体用法?Python bottle.debug怎么用?Python bottle.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bottle
的用法示例。
在下文中一共展示了bottle.debug方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: change_passwords
# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import debug [as 别名]
def change_passwords(username, old_pass, new_pass):
changed = []
for key in (key for key in CONF.sections()
if key == 'ldap' or key.startswith('ldap:')):
LOG.debug("Changing password in %s for %s" % (key, username))
try:
change_password(CONF[key], username, old_pass, new_pass)
changed.append(key)
except Error as e:
for key in reversed(changed):
LOG.info("Reverting password change in %s for %s" % (key, username))
try:
change_password(CONF[key], username, new_pass, old_pass)
except Error as e2:
LOG.error('{}: {!s}'.format(e.__class__.__name__, e2))
raise e
示例2: nif_api
# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import debug [as 别名]
def nif_api(*args, **kwargs):
content_format = request.headers.get('Content') or 'application/x-turtle'
content_type_to_format = {
'application/x-turtle': 'turtle',
'text/turtle': 'turtle',
}
nif_body = request.body.read()
nif_doc = NIFCollection.loads(nif_body)
for context in nif_doc.contexts:
logger.debug(context.mention)
mentions = classifier.create_mentions(context.mention)
classifier.classify_mentions(mentions)
for mention in mentions:
mention.add_phrase_to_nif_context(context)
response.set_header('content-type', content_format)
return nif_doc.dumps()
示例3: run
# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import debug [as 别名]
def run():
bottle.debug(not PROD)
bottle.run(
app=app,
host='localhost',
port='2081',
reloader=not PROD
)
示例4: serve
# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import debug [as 别名]
def serve(server='wsgiref', port=8800, reloader=False, debugmode=False):
"""
Build the html and js files, if needed, then launch the app.
The default server is the single-threaded 'wsgiref' server that comes with
Python. It's fine for a demo, but for production you'll want to use
something better, e.g. server='cherrypy'. For an extensive list of server
options, see http://bottlepy.org/docs/dev/deployment.html
"""
bottle.debug(debugmode)
## Client side tracks _state['server_start_time']
## to decide if it should reload.
_state['server_start_time'] = time.time()
## rebuild as needed
doBuild()
## Launch the web service loop.
bottle.run(app,
host='0.0.0.0',
server=server,
port=port,
reloader=reloader,
debug=debugmode)
###################################################
## The following runs only when we start from
## the command line.
###################################################
示例5: serve
# 需要导入模块: import bottle [as 别名]
# 或者: from bottle import debug [as 别名]
def serve(server='wsgiref', port=8800, reloader=False, debugmode=False):
"""
Build the html and js files, if needed, then launch the app.
The default server is the single-threaded 'wsgiref' server that comes with
Python. It's fine for a demo, but for production you'll want to use
something better, e.g. server='cherrypy'. For an extensive list of server
options, see http://bottlepy.org/docs/dev/deployment.html
"""
bottle.debug(debugmode)
## Client side tracks _state['server_start_time']
## to decide if it should reload.
_state['server_start_time'] = time.time()
## rebuild as needed
doBuild()
## Launch the web service loop.
bottle.run(app,
host='0.0.0.0',
server=server,
port=port,
reloader=reloader,
debug=debugmode)
## The following runs only when we start from
## the command line.