[PyQt] Eric, debugging a flask application

Detlev Offenbach detlev at die-offenbachs.de
Sat May 25 12:00:33 BST 2019


Hello Guðjón,

would you be willing to create a little Howto/Tutorial for the eric web-site? 
If so, please send me the HTML for the main part and I'll wrap it in the eric 
web site layout.

Regards,
Detlev

Am Samstag, 25. Mai 2019, 08:01:19 CEST schrieb Guðjón Guðjónsson:
> 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
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

-- 
Detlev Offenbach
detlev at die-offenbachs.de




More information about the PyQt mailing list