简体   繁体   中英

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()

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM