Пример #1
0
                "pyramid.reload_all": True}

    Base.metadata.drop_all()
    Base.metadata.create_all()

    Session.add(User(name="foo", age=20))
    Session.commit()

    config = Configurator(settings=settings)
    config.include("pyramid_mako")

    config.add_tween("onefile.simple_commit_tween")

    ## komet::
    config.include("komet")
    config.set_komet_dbsession(Session)
    config.add_komet_model_renderer(Base)
    config.add_komet_apiset(User, "users")

    config.add_komet_custom_data_validation("create", User, unique_name)
    config.add_komet_custom_data_validation("edit", User, unique_name)



    ## ui::
    config.add_mako_renderer(".html")
    config.add_route('top', '/')
    config.add_view(top_view, route_name='top', renderer="onefile.html")
    config.add_static_view("static", path="%(here)s/static" % {"here": here})
    config.add_static_view("bower", path="%(here)s/bower_components" % {"here": here})