5

I use Flask framework and build a Python project. It shows all errors on the page when I run a python file on the SSH shell.

After I installed WSGI to run the server automatically, it started not showing errors on the browser. It only shows "Internal Server Error" if there is an error.

my python file has this option at the end.

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=5000,debug=True)

I would like to look at all errors to figure out problems. Is there a way to look at all errors on the browser?

Saravanan
  • 363
  • 1
  • 14
Jake
  • 1,195
  • 6
  • 21
  • 42
  • 1
    This may help [activating-the-flask-debugger-when-running-under-mod-wsgi](http://stackoverflow.com/questions/10566107/activating-the-flask-debugger-when-running-under-mod-wsgi) – flyer Dec 05 '13 at 09:46
  • @flyer I did that. I can't see the errors.. – Jake Dec 05 '13 at 11:41
  • 1
    Is your WSGI process running behind another server (like Apache or Nginx)? If so, then are the 500 errors actually your server not correctly configured to connect to the WSGI process, and you need to look at the server (Apache or Nginx) logs? – Mark Hildreth Dec 05 '13 at 14:31

2 Answers2

6

I finally noticed that it doesn't show errors on the browser because I run the server under WSGI mod.

Python Flask shows detailed errors on the browser if I run the python file on the shell.

app.debug = True

This is a command to look at detailed errors.

So, I had to turn off WSGI mod to run python file to look at detailed errors that Flask supported.

Jake
  • 1,195
  • 6
  • 21
  • 42
1

Please someone explain to me why the following approach doesnt display the erros in the browser which is what i want to do:

app = Flask(__name__)
app.debug = True
application = app

Its very tedieous task to always have to tail -f ../logs/error_log