I\'m not looking to turn on the dangerous debugging console, but my application is getting a 500 error and doesn\'t seem to be writing any output for me to investigate more deep
Set config['PROPAGATE_EXCEPTIONS']
to True
when running app in production and you want tracebacks to be logged into log files. (I haven't tried with SMTP handler, though..)
I know that this is a VERY old post, but I ran into the issue now, and it took me a bit to find the solution. Flask sends errors to the server. I was running Gunicorn with an upstart script on Ubuntu 14.04 LTS, and the place where I found the error logs was as follows:
/var/log/upstart/myapp.log
http://docs.gunicorn.org/en/stable/deploy.html#upstart
Just in case some other poor soul ends up in this situation.
if __name__ == '__main__'
clause, i.e. your main entry point. I assume that would be run.py
.nginx
level.Update: You might want to have an exception clause that covers uncaught exceptions, e.g.
if __name__ == '__main__':
try:
app.run(debug=True)
except Exception:
app.logger.exception('Failed')
which should write the traceback of any exception which occurred in app.run()
to the log.