Add an API-specific 404 handler.

URLs within the /api/ tree that return 404 end up returning the full HTML 404,
rather than an API error code. This is kind of crummy, especially when using
the python API bindings. This change adds a catch-all handler at the end of the
URL patterns to return the API error code.

Testing done:
curl http://127.0.0.1:8080/notfound/
curl http://127.0.0.1:8080/api/notfound/

Fixes bug 3052.
Reviewed at https://reviews.reviewboard.org/r/4464/