Ricardo Polo Jaramillo
Ricardo Polo Jaramillo

Reputation: 12318

Redirect all url request to one handler

In a Google App Engine application with google webapp framework, how do I redirect every request to one handler?

Check this code:

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello, webapp World!')

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

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

How can i change the application = webapp.WSGIApplication([('/', MainPage)], debug=True) line to redirect all the requests instead only the /. I tried and * and /* and it does not work.

Upvotes: 0

Views: 222

Answers (1)

Dave W. Smith
Dave W. Smith

Reputation: 24956

application = webapp.WSGIApplication([('/.*', MainPage)], ...

Upvotes: 5

Related Questions