Map different URLs to same view
pyramid, python
Solution
You need to add them under different route names (they must be unique per application):
config.add_route('home','/')
config.add_route('home1','home/')
and then configure the same view for both:
config.add_view(yourview, route_name='home')
config.add_view(yourview, route_name='home1')
or, in case of using `@view_config` decorator, double-decorate your method:
@view_config(route_name='home')
@view_config(route_name='home1')
def your_method(request):
.....
Problem
It seems trivial enough but I can't find a valid answer to this problem. Suppose I have two different links '/' and '/home' and I want them to point to the same view. (This means whether user opens xyz.com or xyz.com/home, same page will be displayed). In pyramid I tried ``` config.add_route('home','/') config.add_route('home','home/') ``` But it raises the following exception ``` pyramid.exceptions.ConfigurationConflictError: Conflicting configuration actions For: ('route', 'home') ``` How should I actually implement this?