A Conway
A Conway

Reputation: 3

How do I view errors my Flask App is returning?

I've started to make an app using Python 3 with the Flask framework. I mostly followed this tutorial. I'm currently using a free-tier AWS Ubuntu-16.04 server to host the app on while trying to develop it.

How am I meant to see the errors that my Flask App is returning? - as most of the time I receive a 500 Internal Server Error in my browser. Also is there an easier setup I should be using to develop and debug the app.

Thanks

Edit 1:

#!/usr/bin/python
from flask import Flask, render_template, request


app = Flask(__name__)
app.debug = True


@app.route('/table')
def current_return():
    data = ['one', 'two', 'three']
    return render_template("current.html",data = data)


if __name__ == "__main__":
    app.run()

Upvotes: 0

Views: 347

Answers (1)

sytech
sytech

Reputation: 40891

You should enable debugging for your app.

app = Flask(__name__)
app.debug = True

That will output the traceback on the error pages, instead of just a generic 'Server error' page.

Upvotes: 1

Related Questions