Is there any difference between splitting an application in a url.Uaml router or webapp2 URI

Consider the following two scenarios:

In app.yaml

There are two URL handlers.
handlers: - url: /main script: main.app1 - url: /secondary script: secondary.app2 

and URI router in main.py

 app1 = webapp2.WSGIApplication([('/main', MainHandler)]) 

and the other in secondary.py

 app2 = webapp2.WSGIApplication([('/secondary', SecondaryHandler)]) 

vs

There is one URL handler in app.yaml

 handlers: - url: /.* script: main.app 

and the URI handles the router

 app = webapp2.WSGIApplication([ ('/main', MainHandler), ('/secondary', SecondaryHandler) ]) 

Is there a difference in how App Engine imports two scripts? If all the queries are for MainHandler, does the App Engine allow importing files related to SecondaryHandler in the first script or when the instance always imports each handler the first time it is initialized?

Obviously, these are different ways to split the application logically, but I ask if there are any performance considerations related to this.

+4
source share
1 answer

You can use the lazy handler in webapp2 to optimize the loading and use of a single application. See this link: https://webapp2.readthedocs.io/en/latest/guide/routing.html#lazy-handlers

+7
source

All Articles