How to print from Flask @app.route to python console

前端 未结 4 2061
无人及你
无人及你 2021-01-30 06:14

I would like to simply print a \"hello world\" to the python console after /button is called by the user.

This is my naive approach:

@app.route(\'/button         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 06:45

    I think the core issue with Flask is that stdout gets buffered. I was able to print with print('Hi', flush=True). You can also disable buffering by setting the PYTHONUNBUFFERED environment variable (to any non-empty string).

提交回复
热议问题