有没有办法在Python Flask RESTFUL中配置路由层次结构?

有没有办法在Python Flask RESTFUL中配置路由层次结构?,python,routes,nested-resources,flask-restful,nested-routes,Python,Routes,Nested Resources,Flask Restful,Nested Routes,假设我有几条路线: api.add_resource(Customers, "/Customers") api.add_resource(Customer, "/Customer/<int:customerId>") 烧瓶似乎没有一个内置的方式来实现这一点。但是,您仍然可以使用Python功能: customer_path = '/Customer/<int:customerID' api.add_resource(Customer, customer_path) api.a

假设我有几条路线:

api.add_resource(Customers, "/Customers")
api.add_resource(Customer, "/Customer/<int:customerId>")

烧瓶似乎没有一个内置的方式来实现这一点。但是,您仍然可以使用Python功能:

customer_path = '/Customer/<int:customerID'
api.add_resource(Customer, customer_path)
api.add_resource(Orders, customer_path + '/Orders')
api.add_resource(Order, customer_path + '/Order/<int:orderId>')

customer\u path='/customer/对此感到害怕。谢谢。第一行缺少一个
api.add_resourceToPrevious([oldRoute], [newRouteController], [newRouteToAppendToOld])
customer_path = '/Customer/<int:customerID'
api.add_resource(Customer, customer_path)
api.add_resource(Orders, customer_path + '/Orders')
api.add_resource(Order, customer_path + '/Order/<int:orderId>')