I\'ve setup a static website on GAE using hints found elsewhere, but can\'t figure out how to return a 404 error. My app.yaml file looks like
- url: (.*)/
You need to register a catch-all script handler. Append this at the end of your app.yaml:
- url: /.*
script: main.py
In main.py you will need to put this code:
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class NotFoundPageHandler(webapp.RequestHandler):
def get(self):
self.error(404)
self.response.out.write('')
application = webapp.WSGIApplication([('/.*', NotFoundPageHandler)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
Replace with something meaningful. Or better use a template, you can read how to do that here.
Please let me know if you have problems setting this up.