本文整理匯總了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.