Changed app/views.py to include error handling functions for HTTP 500 and 404.
In the 500 error handler, we make a call to db.session.rollback() because we do not want the DB to end up in an invalid state.