Esempio n. 1
0
    def run(self):
        failing = True
        while failing:
            try:
                run(app=self.bottle, host=self.addr, port=self.port, debug=True)
                failing = False #run exited for a reasonable reason

            except Exception:
                logging.exception("Net service errored out somehow.  Retrying in 5 seconds.")
                time.sleep(5)
Esempio n. 2
0
    Core mirrordom server functionality
    """
    print "START %s" % (name)
    global mirrordom_storage
    query = bottle.request.params
    parsed_query = dict((k, json.loads(v)) for k,v in query.iteritems())
    result = getattr(mirrordom.server, "handle_" + name)(mirrordom_storage, **parsed_query)
    print "END %s" % (name)
    return result

@app.route('/debug_storage')
def debug_storage():
    """ Static mirrordom js files """
    global mirrordom_storage
    from xml.sax.saxutils import escape
    storage_str = pprint.pformat(mirrordom_storage)
    storage_str = escape(storage_str)
    return "<html><body><pre>%s</pre></body></html>"  % (storage_str)

@app.route('/static/mirrordom/<filepath:path>')
def js_static(filepath):
    """ Static mirrordom js files """
    return bottle.static_file(filepath, root=MIRRORDOM_JS_PATH)

@app.route('/static/<filepath:path>')
def static(filepath):
    """ Static files """
    return bottle.static_file(filepath, root=STATIC_PATH)

bottle.run(app, host='localhost', port=8079, debug=True)
Esempio n. 3
0
    parsed_query = dict((k, json.loads(v)) for k, v in query.iteritems())
    result = getattr(mirrordom.server, "handle_" + name)(mirrordom_storage,
                                                         **parsed_query)
    print "END %s" % (name)
    return result


@app.route('/debug_storage')
def debug_storage():
    """ Static mirrordom js files """
    global mirrordom_storage
    from xml.sax.saxutils import escape
    storage_str = pprint.pformat(mirrordom_storage)
    storage_str = escape(storage_str)
    return "<html><body><pre>%s</pre></body></html>" % (storage_str)


@app.route('/static/mirrordom/<filepath:path>')
def js_static(filepath):
    """ Static mirrordom js files """
    return bottle.static_file(filepath, root=MIRRORDOM_JS_PATH)


@app.route('/static/<filepath:path>')
def static(filepath):
    """ Static files """
    return bottle.static_file(filepath, root=STATIC_PATH)


bottle.run(app, host='localhost', port=8079, debug=True)