Ejemplo n.º 1
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri, etherpaddy)
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
Ejemplo n.º 2
0
def main(global_config, **settings):
    """
        Main function : returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)

    config = Configurator(settings=settings)
    config.add_static_view('static', 'etherpaddy:static',
                                            cache_max_age=3600)
    config.add_route('index', '/')
    # REST API
    # using the four HTTP methods (POST, GET, PUT, DELETE),
    # translating them in (add, get, update, delete)
    # and the two following routes,
    # we can get a very clean REST API
    config.add_route("pads", "/pads")
    config.add_route("padnew", "/pads/new")
    config.add_route("pad", "/pads/{padid}")

    config.scan('etherpaddy')
    return config.make_wsgi_app()