Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep simpleserver active even on syntax errors

Is there a way to configure the simple-server that Flask uses to not exit on every single syntax error?

app = Flask(__name__)
app.run(host='0.0.0.0', debug=True, use_debugger=True, passthrough_errors=False);

Currently I'm using this setup for the simple-server. Setting passthrough_errors to False means most of the errors actually keeps the process alive so that I can use the interactive debugger, syntax errors still exits the program though. I've tried different configuration values but I have not found anything that works. Thanks!

like image 347
moodh Avatar asked Aug 06 '12 17:08

moodh


1 Answers

I just posted a Flask-Failsafe extension to solve this exact issue.

I hit this all the time and ran across your post earlier looking for a solution. After a bit of experimenting I hacked up a decorator you can use to wrap your initialization code so that if it fails the reloader will keep working. Check it out and let me know what you think.

like image 134
Matt Good Avatar answered Oct 19 '22 05:10

Matt Good