【发布时间】:2012-08-22 20:54:47
【问题描述】:
来自CherryPy 的MethodDispatcher 是否处理多个url 路径?我正在尝试执行类似下面的操作,但是虽然对/customers 的请求工作正常,但对/orders 的请求总是返回“404 没有与给定的 URI 匹配”。
class Customers(object):
exposed = True
def GET(self):
return getCustomers()
class Orders(object):
exposed = True
def GET(self):
return getOrders()
class Root(object):
pass
root = Root()
root.customers = Customers()
root.orders = Orders()
conf = {
'global': {
'server.socket_host': '0.0.0.0',
'server.socket_port': 8000,
},
'/': {
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
},
}
cherrypy.quickstart(root, '/', conf)
【问题讨论】:
-
嗨,你解决了吗?我遇到了完全相同的问题...
-
我怀疑这是我使用的 CherryPy 版本中的错误。我无法在另一台机器上重现它,所以我清理了我的环境,重新安装了所有东西,问题就消失了。