import logging
if not app.debug:
    stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.INFO)
app.logger.addHandler(stream_handler)
How to see exceptions in a Flask + gunicorn app?