Skip to content

Instantly share code, notes, and snippets.

@mcdonc
Created May 8, 2015 21:22
Show Gist options
  • Save mcdonc/1ede40ff374763d6de07 to your computer and use it in GitHub Desktop.
Save mcdonc/1ede40ff374763d6de07 to your computer and use it in GitHub Desktop.
# sameroute.py
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
return Response('Hello %(name)s!' % request.matchdict)
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/hello/{name}')
config.add_route('hello', '/hello/{name}')
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
# running env27/bin/python env27/sameroute.py
Traceback (most recent call last):
File "env27/sameroute.py", line 13, in <module>
app = config.make_wsgi_app()
File "/home/chrism/projects/pyramid/pyramid/config/__init__.py", line 957, in make_wsgi_app
self.commit()
File "/home/chrism/projects/pyramid/pyramid/config/__init__.py", line 631, in commit
self.action_state.execute_actions(introspector=self.introspector)
File "/home/chrism/projects/pyramid/pyramid/config/__init__.py", line 1066, in execute_actions
for action in resolveConflicts(self.actions):
File "/home/chrism/projects/pyramid/pyramid/config/__init__.py", line 1194, in resolveConflicts
raise ConfigurationConflictError(conflicts)
pyramid.exceptions.ConfigurationConflictError: Conflicting configuration actions
For: ('route', 'hello')
Line 10 of file env27/sameroute.py:
config.add_route('hello', '/hello/{name}')
Line 11 of file env27/sameroute.py:
config.add_route('hello', '/hello/{name}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment