Re: Eric, debugging a flask application

Guðjón Guðjónsson <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <CAOTq_2WNWiNVFJai2c+RNmzTtJ+3T9Ti_1yu+UTeAj_dBFHyjw@mail.gmail.com>
Hi Detlev

Thanks for the answer
On Fri, May 24, 2019 at 8:02 PM Detlev Offenbach
<[email protected]> 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
_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.