[PyQt] Eric, debugging a flask application
Guðjón Guðjónsson
gudjon.i.gudjonsson at gmail.com
Sat May 25 07:01:19 BST 2019
Hi Detlev
Thanks for the answer
On Fri, May 24, 2019 at 8:02 PM Detlev Offenbach
<detlev at die-offenbachs.de> wrote:
>
> Hi,
>
> is flask executed in a separate process? I don't know how the flask web server
> is started. Maybe you have to run the flask web server main script within the
> debugger.
When I tried to make a small example of the problem, it just works.
Introduction to Flask can be found here:
http://flask.pocoo.org/
A simple example:
hello.py
"""
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
"""
$ pip install Flask
$ FLASK_APP=hello.py flask run
* Running on http://localhost:5000/
But for debugging I got a hint from
https://wingware.com/doc/howtos/flask
and the script is changed to:
hello.py
"""
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
retstr = "Hello World!"
return retstr
if __name__ == "__main__":
# Preferably check if Eric debugger is active before switching off
Flasks internal debugger
app.debug = False # Switch off Flask internal debugger.
app.run()
"""
This works fine in the Eric debugger
But for some reason this doesn't work in the program I want to debug.
It doesn't stop at my
breakpoints. But when I moved the debug to a parameter in the run
command it works.
if __name__ == "__main__":
#app.debug = False
app.run(debug=False)
Now it works perfectly :)
Regards
Gudjon
More information about the PyQt
mailing list