Python bottle.debug() Examples

The following are 7 code examples of bottle.debug(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bottle , or try the search function .
Example #1
Source File: app.py    From ldap-passwd-webui with MIT License 6 votes vote down vote up
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 
Example #2
Source File: app.py    From opentapioca with Apache License 2.0 6 votes vote down vote up
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() 
Example #3
Source File: run.py    From bottle-react with MIT License 5 votes vote down vote up
def run():
  bottle.debug(not PROD)
  bottle.run(
    app=app, 
    host='localhost',
    port='2081',
    reloader=not PROD
  ) 
Example #4
Source File: run.py    From bottle-react with MIT License 5 votes vote down vote up
def run():
  bottle.debug(not PROD)
  bottle.run(
    app=app, 
    host='localhost',
    port='2081',
    reloader=not PROD
  ) 
Example #5
Source File: server.py    From NearlyPurePythonWebAppDemo with MIT License 5 votes vote down vote up
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.
################################################### 
Example #6
Source File: allinone.py    From NearlyPurePythonWebAppDemo with MIT License 5 votes vote down vote up
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. 
Example #7
Source File: minimal_allinone.py    From NearlyPurePythonWebAppDemo with MIT License 5 votes vote down vote up
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.