集中烧瓶路线

时间:2017-04-07 08:39:35

标签: python flask

我的同事希望将Web服务器的所有路由放在一个路由文件中,而不是将它们分散到一堆函数中。这就是他在Java / Play中的表现:

from flask import Flask
import controllers.application

app = Flask(__name__)
routes = '''\
GET    /recovery        controllers.application.recovery
GET    /signup          controllers.application.signup
GET    /<lang>/signup   controllers.application.signup'''

for route in routes.splitlines():
    method,path,func = route.split()
    app.add_url_rule(rule=path, view_func=eval(func), methods=[method])

app.run()

在Flask中可行/容易吗?

1 个答案:

答案 0 :(得分:-2)

是的,非常简单:

    this.api.elements('css selector', ".table tbody td",function(result){
       console.log(result.value)  // this should contains rows detail
    })