.add_route


Definition
 Allow to associate the route pattern in configuration

Syntax
 config.add_route('show_users', '/show')

Examples
The Response returns the union of frozenset x, y. 
from pyramid.response import Response

def frozenset1(request):
    x=frozenset({7,9,11,13})
    y=frozenset({5,10,15})
    z=frozenset.union(x,y)
    z=str(z)
    return Response('The union of frozenset is:' + z)
        
if __name__ == '__main__':
    config = Configurator()
    config.add_route('set', '/')
    config.add_view(frozenset1, route_name='set')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 1050, app)
    server.serve_forever()






Comments