Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make Flask more verbose?

Tags:

python

flask

I've been using Flask for a little while and find I prefer it to Rails in some ways, particularly for being lightweight. However, one area in which Rails is far superior in my opinion is error reporting. There are many times in Flask where I get an error in my browser, but my console shows no error at all (for example, trying to pull non-existant querystring parameters out of request.form produces a 400 Bad Request, but all you see on the console is the incoming request).

Is there any kind of a verbose mode on Flask which will give me detailed information on all of its behavior?

like image 368
limp_chimp Avatar asked May 30 '13 17:05

limp_chimp


People also ask

Why Flask is not suitable for production?

While lightweight and easy to use, Flask's built-in server is not suitable for production as it doesn't scale well. Some of the options available for properly running Flask in production are documented here.


2 Answers

The debug mode can be enabled via env variable (export FLASK_DEBUG=1) or within the code to allow printing traceback in case of errors as noted below:

app = Flask(__name__)
app.debug = True
like image 185
Punit S Avatar answered Oct 16 '22 08:10

Punit S


You probably want to enable debug mode.

like image 3
ʇsәɹoɈ Avatar answered Oct 16 '22 09:10

ʇsәɹoɈ