Example #1
0
def main(environ, argv):
    conf = configs.get_configs("yakity.conf")

    # enable both access and error logging, and print it to stdout
    logging.getLogger('feather').setLevel(logging.INFO)
    logging.getLogger('feather').addHandler(logging.StreamHandler())

    wsgi.serve(("localhost", 8989),
            functools.partial(app, conf),
            worker_count=1)
Example #2
0
        yield "\t\t<p>%d</p>\n" % i
    yield "\t</body>\n</html>"

@app.get("^/fail/$")
def fail(http):
    raise Exception("omg I broke")

@app.handle_500
def on_failure(http, triple):
    http.add_header('content-type', 'text/plain')
    return ("An Error Occurred:\n\n"
            + ''.join(traceback.format_exception(*triple)))

subapp = App()

@app.get("^/subapp")
def delegate_to_subapp(http):
    return subapp

@subapp.get("/$")
def subapp_index(http):
    return "index of the sub-app"

@subapp.get("/hello/world/$")
def subapp_helloworld(http):
    return "<p>subapp says:</p><h2>Hello, World!</h2>"


if __name__ == '__main__':
    serve(("localhost", 9090), app, worker_count=1, traceback_body=True)