I'm developing a Flask website using Visual Studio 2013's PythonTools, which has its own debugger, and that allows me to step through the initial setup code, up until app.run()
However the code I want to debug is the routing code, like this:
@app.route('/')
def url_index():
return render_template('index.html')
I know that function is running because the server does respond with index.html, but if I put a breakpoint on the last line, it'll never get hit.
Is there any way to debug these routing functions? Flask says it comes with a debugger but how do I use it? Will it be compatible with Visual Studio?
For the Flask debugger, you can set app.debug
to True
:
app.debug = True
or
app.run(debug=True)
And then:
@app.route('/')
def index():
raise
return render_template('index.html')
And then you can debug the function with the Flask debugger in your browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With