Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 868209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:06:07+00:00 2026-05-15T10:06:07+00:00

Scenario 1 This involves using one gateway route in app.yaml and then choosing the

  • 0

Scenario 1

This involves using one “gateway” route in app.yaml and then choosing the RequestHandler in the WSGIApplication.

app.yaml

- url: /.*
  script: main.py

main.py

from google.appengine.ext import webapp

class Page1(webapp.RequestHandler):
    def get(self):
        self.response.out.write("Page 1")

class Page2(webapp.RequestHandler):
    def get(self):
        self.response.out.write("Page 2")

application = webapp.WSGIApplication([
    ('/page1/', Page1),
    ('/page2/', Page2),
], debug=True)

def main():
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
    main()

Scenario 2:

This involves defining two routes in app.yaml and then two separate scripts for each (page1.py and page2.py).

app.yaml

- url: /page1/
  script: page1.py
- url: /page2/
  script: page2.py

page1.py

from google.appengine.ext import webapp

class Page1(webapp.RequestHandler):
    def get(self):
        self.response.out.write("Page 1")

application = webapp.WSGIApplication([
    ('/page1/', Page1),
], debug=True)

def main():
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
    main()

page2.py

from google.appengine.ext import webapp

class Page2(webapp.RequestHandler):
    def get(self):
        self.response.out.write("Page 2")

application = webapp.WSGIApplication([
    ('/page2/', Page2),
], debug=True)

def main():
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
    main()

Question

What are the benefits and drawbacks of each pattern? Is one much faster than the other?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:06:07+00:00Added an answer on May 15, 2026 at 10:06 am

    The only performance implication relates to the loading of modules: Modules are loaded on an instance when they’re first used, and splitting things up requires fewer module loads to serve a page on a new instance.

    This is pretty minimal, though, as you can just as easily have the handler script dynamically load the needed module on-demand – and that’s what many common frameworks already do.

    In general, app.yaml routing is designed for routing between distinct components or applications. For example, remote_api and deferred both have their own handlers. It’s perfectly reasonable, therefore, to have a single handler defined for your app that handles everything else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Another collinear-points question. This one's twist is, I'm using integer arithmetic, and I'm looking
Let us take this example scenario: There exists a really complex function that involves
Consider this scenario: I've an XML file called person.xml with the following data in
Consider this scenario. I have my own website, that I use as my identifier,
Consider this scenario. I have an object, lets call it.... Foo. Foo raises a
This scenario comes up often, now that I use LinkToSql and the classes it
Is this scenario even possible? class Base { int someBaseMemer; }; template<class T> class
Imagine this scenario: You have a desktop and a laptop. The desktop has a
In this scenario, I have 2 or more models: class Store(models.Model): name = models.CharField(max_length
At this moment I use this scenario to load OpenGL texture from PNG: load

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.