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 can create a function to handle your errors for any of the status codes. You're case being 404, define a function like this:
def Handle404(request, response, exception):
response.out.write("Your error message")
response.set_status(404)`
You can pass anything - HTML / plain-text / templates in the response.out.write function. Now, add the following declaration after your app declaration.
app.error_handlers[404] = Handle404
This worked for me.