Set up custom 404 page with exception routing

- use styles and template from @fofr's prototype
- leave 500 using the default Rails page for now
- use new StaticContentController
Remove default 404 page

Otherwise this will be used for requests directly to /404
Test that custom 404 page used if mapping not found

The change to the test environment config is needed to allow Rails
to handle the RecordNotFound exception and pass it on to our custom
handling.
Test that hits pages for a non-existent site 404

This tests existing behaviour, because we're already finding the site
on the hits controller with find_by_abbr!
404 for a non-existent organisation

This was returning 500 instead, because we were finding the organisation
with the non-'!' find_by_ method and so the exception occurred later when
trying to call a method on nil.
404 for a non-existent site from SitesController

This covers only the site dashboard.
404 for a non-existent site from MappingsController

This covers all the mappings pages, but only tests the mappings
index for a non-existent site.
Also handle 422 via StaticContentController

This is the third status which Rails provides default pages for, and
will use if certain exceptions are raised, so we should continue to
handle this status. For now this still renders the default page.
Refactor into a single step for custom 404 page
Test custom 404 page when no route matches
Make error pages work without authentication

We need our error handling to also work for the hosts API, which does
not require authentication. It's also error-prone to assume that we
have a logged-in user with everything working correctly when we're
handling an exception as 500.

- inherit from ActionController::Base instead of ApplicationController
- use a stripped-down error_page layout instead of the default
  application layout, which doesn't require a logged-in user
- include only messages in the view for each error action
- add controller spec
Test that hosts API shows 500 page with broken data

We have accidentally left hosts without a site in the database after
manually cleaning up wrongly imported data a couple of times. This
is a case in which it is particularly important that the response
should be 500 if we have bad data.
Support JSON error responses

This mainly applies to the hosts API, but is simple to do and good
practice for any other requests too.