mongodb - Load end points from multiple files dynamically - Python Flask -


i trying create web service using flask , mongodb.

i have earlier worked tornado had classes in different files , able load end points dynamically using get_routes tornado_json.routes.

import tornado.ioloop import tornado.web import json import custom tornado_json.routes import get_routes tornado_json.application import application  if __name__ == "__main__":     # automatically generate routes webapp    routes = get_routes(custom)      # create , start application    application = application(routes=routes,settings={"cookie_secret": "ffcd62b9ce7f9f0c28681112ca15e2145f8fc4005c0716a2a9f4ddedb0b40871",})     application.listen(5000)    tornado.ioloop.ioloop.current().start() 

in above code custom refers directory .py files where.

whenever application starts loads endpoints folder.

i know if there similar method need not

api.add_resource(todosimple, '/<string:todo_id>') 

add these lines every class write in flask.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -