Posts

Showing posts from December, 2012

Appengine: Custom Error Handlers using webapp2 - Python 2.7

Google Developers has a writeup on Custom Error Responses using app.yaml Here is a sample app.yaml app.yaml application: appname version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /static static_dir: static http_headers: Vary: Accept-Encoding - url: /articles/.* script: articles.app On the Development Environment, I get the following error when I visit http://localhost:8080/ i.e the home page Not found error: / did not match any patterns in application configuration. On Appengine, a standard 404 Error is shown Error: Not Found The requested URL / was not found on this server. This is because the app.yaml file does not specify any handler for "/" Here is the articles.py file articles.py import webapp2 class HomePage(webapp2.RequestHandler): def get(self): self.response.write.out("Hello Birds!") app = webapp2.WSGIApplication( [ (r'/articles/', HomePage) ], debug=True) Specify