예제 #1
0
def dogs_reg():
    dog_items = [("http://example.com/id/dog/{}".format(i['name']), i['name']) for i in dogs]
    r = RegisterRenderer(request,
                         API_BASE + '/dogs',
                         "Dogs Register",
                         "A complete register of my dogs.",
                         dog_items,
                         ["http://example.com/Dog"],
                         len(dog_items),
                         super_register=API_BASE + '/',
                         register_template='register.html',
                         alternates_template='alternates.html'
                         )
    return r.render()


@app.route('/')
def index():
    rofr = RegisterOfRegistersRenderer(request,
                                       API_BASE,
                                       "Register of Registers",
                                       "A register of all of my registers.",
                                       "./rofr.ttl"
                                       )
    return rofr.render()


if __name__ == "__main__":
    pyldapi_setup(app, '.', API_BASE)
    app.run("127.0.0.1", 8081, debug=True, threaded=True, use_reloader=False)
예제 #2
0
@app.route('/dogs')
def reg2():
    dog_items = [("http://example.com/id/dogs/{}".format(i['name']), i['name']) for i in dogs]
    r = RegisterRenderer(request,
                         request.url_root + 'dogs',
                         "Dogs Register",
                         "A complete register of my dogs.",
                         dog_items,
                         ["http://example.com/Dog"],
                         len(dog_items),
                         super_register=request.url_root,
                         register_template='testme.html',
                         alternates_template='testme2.html'
                         )
    return r.render()

@app.route('/')
def index():
    rofr = RegisterOfRegistersRenderer(request,
                                       request.url_root,
                                       "Register of Registers",
                                       "A register of all of my registers.",
                                       "./rofr.ttl"
                                       )
    return rofr.render()

if __name__ == "__main__":
    pyldapi_setup(app, '.', 'http://127.0.0.1:8081')
    app.run("127.0.0.1", 8081, debug=True, threaded=True, use_reloader=False)