首页 \ 问答 \ 高级Webapp2路由(Advanced Webapp2 Routing)

高级Webapp2路由(Advanced Webapp2 Routing)

在旧式webapp中,基于app.yaml的路由允许您检查正则表达式,如果匹配,则由处理程序处理请求,该处理程序的名称基于找到的模式。 例如,如果匹配的模式是“user”,则\ 1_handler.py会调度到user_handler.py。

有没有办法用webapp2.Route做同样的事情? 惰性处理程序或method_handler参数可以基于模板中匹配的模式吗?


In old school webapp, app.yaml based routing allowed you to check for regular expressions and if matched, process a request by a handler whose name is based on the found pattern. For example \1_handler.py would dispatch to user_handler.py if the matched pattern was 'user'.

Is there a way to do the same thing with webapp2.Route? Can the lazy handler or the method_handler parameters be based on the matched patterns in template?


原文:https://stackoverflow.com/questions/8824383
更新时间:2023-10-25 16:10

相关问答

更多
  • 这是一个非常主观的问题 - 没有任何背景,任何人都不可能推荐使用哪个。 哪个数据库最适合您取决于各种各样的事情,包括但不限于 阅读模式 写模式 查询复杂性 可扩展性要求 领养率 语言支持 商业支持 耐久力 交易支持 数据的完整性 还有更多 您需要考虑您的应用程序并理解我上面列出的内容,并从数据库中找出您需要的内容。 然后你需要了解你的每个选项,哪些就足够了。 This is a very subjective question - without any context, its impossible fo ...
  • vNext应用程序可以使用.NET框架的云优化子集。 框架的这个子集大小约为11兆字节,而整个框架为200兆字节,并且由一组NuGet包组成。 您不需要使用框架的这个子集,您仍然可以使用完整框架,具体取决于您的应用程序需要的框架的哪些部分。 以前,MVC和WebApi之间存在适量的重复概念。 路由系统和框架扩展点非常相似但不同的实现。 他们现在是同一个框架。 如果你愿意,你可以在同一个控制器中返回MVC和WebApi结果。 网页将在以后的版本中添加到MVC 6中。 ASP.NET 5(小组讨论) http: ...
  • 为什么不比价? 为您的IAAS mongodb收取直接Azure费用,并分配相同的预算以购买CosmosDb请求单元的津贴。 这将代表一个非常基本的比较。 接下来,微调您的比较,真正体现PaaS CosmosDb的一些优势。 假设你可以每天10小时拨30%的分配RU。 为每分钟的请求单位启用新的附加配置。 当启用此功能时,Microsoft引用了20%的成本节省。 最后,将数据库管理员的工资的10%添加到您的IAAS总成本中。 Why not compare on price? Take the direc ...
  • 我不确定你是否可以像这样连接到mongodb服务器。 由于cloud9仅导出端口8080,8081和8082您将无法从外部访问27017 。 要访问本地mongodb服务器,您应该能够使用mongodb://localhost:27017而且应该可以使用。 I'm not sure if you can connect to the mongodb server like that. Since cloud9 only exports ports 8080, 8081, and 8082 you won't ...
  • 虽然你的VCAP_SERVICES解析似乎有效(你得到一个包含主机名和端口的URL),但我强烈建议利用其中一个现有的库来进行进一步的项目: https : //www.npmjs.com/package/cfenv 请你解析你的mongo凭证是否正常工作( cf e ${app_name} ,查找VCAP_SERVICES,手动比较) 如果你想用独立的代码来测试你的服务,这里有一个示例应用程序,我很快就会一起测试绑定到它的所有mongodb服务: 的package.json: { "name": "mo ...
  • Nathan Loyer有正确的答案,虽然它当然比这更复杂。 如果你像我一样并且不知道你在做什么,这里有一个对我有用的详细解释,以及我在底部得到这些信息的资源,以防任何事情得到更新并让你过时。 请注意,您需要为要迁移的每个集合执行此操作。 你可能只有一个或几个集合,所以这并不麻烦。 如果你想移动一个完整的数据库,可以调整这些指令,但这取决于你。 找出你想要移动的集合。 为此,在Cloud9中,在相应的目录中,在命令行中,运行以下命令,并记住或记下您标识的数据库和集合。 (如果你不确定集合,你可以做db。(集 ...
  • 由于cloud9控制台中的错误可能告诉你(因为它告诉我何时尝试这个:-)): haalasdoallalsakdl (CloudFoundry): [5/6] Crash log ============/logs/stderr.log============ node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Cannot read ...
  • 作为一个很好的例子,您可以看一下Spring Session实现的这种解释 https://www.infoq.com/articles/Next-Generation-Session-Management-with-Spring-Session 它引用了Redis存储,您可以从PCF服务绑定到您的应用程序。 As a good example, you can have a look on this explanation of Spring Session implementation https:// ...
  • 如果使用副本集,则可以运行多个实例,因为您可以使用内部端点进行节点间通信。 如果您只有独立实例,则它们将无法相互通信,也不会共享数据。 我一直在各种Mongodb会议(DC,硅谷)上展示这个,你可以在这里观看我的演示文稿的硅谷录像。 编辑:10gen现在已经发布了一个.NET项目,它启动了一个复制项,改进了我所做的原创工作,可以在这里下载文档。 You can run multiple instances if you use a replica set, as you can then use inter ...
  • 首次发布时,Atlas不允许对等。 截至2016年11月3日,您现在可以将您的AWS VPC Client VPC同步到您的MongoDB Atlas VPC。 这将允许您桥接您的专用网络。 然后,您可以将您的私有范围甚至安全组中的特定IP地址指定到Atlas白名单中。 此博客提供了有关两个VPC对等过程的完整详细信息。 https://www.mongodb.com/blog/post/introducing-vpc-peering-for-mongodb-atlas When first release ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)