Cherrypy Methoddispatcher With Multiple Url Paths
Does the MethodDispatcher from CherryPy handle multiple url paths? I'm trying to do something like below, but while requests to /customers work fine, requests to /orders always re
Solution 1:
I think I solved it, try using:
cherrypy.tree.mount(Root())
cherrypy.tree.mount(Customers(), '/customers',
{'/':
{'request.dispatch': cherrypy.dispatch.MethodDispatcher()}
}
)
cherrypy.tree.mount(Orders(), '/orders',
{'/':
{'request.dispatch': cherrypy.dispatch.MethodDispatcher()}
}
)
cherrypy.engine.start()
cherrypy.engine.block()
It seems like in order to expose methods in Root
class you have to use annotation @cherrypy.expose
. Setting exposed = True
probably won't work.
See my answer to my own question Combining REST dispatcher with the default one in a single CherryPy app.
Post a Comment for "Cherrypy Methoddispatcher With Multiple Url Paths"