Python CherryPy是否有url_的替代方案?
Flask有一个用于方法调用的url_,用于从其全局设置文件夹设置urlPython CherryPy是否有url_的替代方案?,python,flask,cherrypy,Python,Flask,Cherrypy,Flask有一个用于方法调用的url_,用于从其全局设置文件夹设置url 我如何管理与CherryPy类似的东西?这就是你想要的吗 您可以通过访问装载的url处理程序 cherrypy.tree.apps[mount_point].root root始终是装载点的装载实例。因此,反向函数看起来像: def reverse(cls): # get link to a class type for app_url in cherrypy.tree.apps.keys():
我如何管理与CherryPy类似的东西?这就是你想要的吗 您可以通过访问装载的url处理程序
cherrypy.tree.apps[mount_point].root
root始终是装载点的装载实例。因此,反向函数看起来像:
def reverse(cls):
# get link to a class type
for app_url in cherrypy.tree.apps.keys():
if isinstance(cherrypy.tree.apps[app_url].root, cls):
# NOTE: it will return with the first mount point of this class
return app_url
希望这有帮助 如果你使用,你有它的url\u