0

I am currently writing a simple local Flask app, but I am running into issues with not having any useful debug information when my application fails

The app.py has your basic:

@app.route('/search', methods=['post'])
def search():
    # some search code goes here

I'm running the app in my commandline like this:

python app.py

And then in a separate commandline window, I am CURLing the app like this:

curl -XPOST -d 'text=test input' 'http://0.0.0.0:5000/search'

When I CURL, I would get the following response:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or thereis an error in the application.</p>

Which is fine, I'm not trying to ask for help on debugging my code, however, what I am trying to ask is, in the window I am running the app, all I see is is that the request ended with a 500, but nothing more.

 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [23/Jul/2018 16:33:56] "POST /search HTTP/1.1" 500 -

It doesn't show at all what line it failed on, how it failed, etc etc

I tried running my app through multiple ways, like:

python app.py -d

and setting debug level on the app variable in app.py, but I still don't get any error logs

So my question is, when I CURL, and the request fails with a 500, how do I get useful debug information on what went wrong?

theGreenCabbage
  • 5,197
  • 19
  • 79
  • 169

0 Answers0